我已经使用Gradle启动了一个Java,在那里我将必要的Spring Boot库导入到build.gradle中。在我构建该项目时,它给了我以下错误:
误差
Execution failed for task ':compileTestJava'.
> Could not resolve all files for configuration ':testCompileClasspath'.
> Could not find org.apache.httpcomponents:httpclient:1.2.5.
Required by:
project :
> Could not find org.apache.httpcomponents:httpclient:1.2.5.
Required by:
project : > io.rest-assured:rest-assured:4.1.2
> Could not find org.apache.httpcomponents:httpclient:1.2.5.
Required by:
project : > com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8 > com.microsoft.azure:azure-keyvault:0.9.3
project : > com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8 > com.microsoft.azure:azure-keyvault:0.9.3 > com.microsoft.azure:azure-core:0.9.3
> Could not find org.apache.httpcomponents:httpclient:1.2.5.
Required by:
project : > io.rest-assured:rest-assured:4.1.2 > org.apache.httpcomponents:httpmime:4.5.12
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.htmlBuild.Gradle
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group 'AbtMainTestControl'
version '1.0-SNAPSHOT'
// Versioning of dependencies
wrapper.gradleVersion = '5.5.1'
def cucumberVersion = '4.7.1'
def junitVersion = '5.5.0'
def restVersion = '4.1.2'
def apacheDrillVersion = '1.17.0'
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.13'
compile group: 'com.opencsv', name: 'opencsv', version: '4.0'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '1.2.5'
// https://mvnrepository.com/artifact/org.apache.drill.tools/tools-parent
compile group: 'org.apache.drill.tools', name: 'tools-parent', version: "${apacheDrillVersion}", ext: 'pom'
// Cucumber Pretty Report Plugin
compile group: 'de.monochromata.cucumber', name: 'reporting-plugin', version: '3.0.9'
testCompile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.1.0.jre8'
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.7.0'
testImplementation "io.cucumber:cucumber-java:${cucumberVersion}"
testImplementation "io.cucumber:cucumber-junit:${cucumberVersion}"
testImplementation "io.rest-assured:rest-assured:${restVersion}"
testImplementation "io.rest-assured:json-path:${restVersion}"
testImplementation "io.rest-assured:json-schema-validator:${restVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junitVersion}"
implementation 'junit:junit:4.12'
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin',
'pretty',
'--glue',
'gradle.cucumber',
'src/test/resources/features',
]
}
}
}
test {
//useJUnitPlatform()
systemProperty "cucumber.options", System.properties.getProperty("cucumber.options")
}在本例中,我提取了Spring,以便查看Build.Gradle文件中的问题所在
有人能推荐解决办法/帮助我解决这个问题吗?你的建议将不胜感激:)
发布于 2020-09-29 03:34:48
httpclient的版本-- 1.2.5 --看起来有点差;最新版本是4.5.12。
https://stackoverflow.com/questions/64112256
复制相似问题