如何修复';的执行任务失败:compileTestJava';?
我已经使用如何修复';的执行任务失败:compileTestJava';?,java,gradle,intellij-idea,Java,Gradle,Intellij Idea,我已经使用Gradle启动了一个Java项目,我已经将必要的Spring Bootlibs导入build.Gradle。在我构建项目时,它给了我以下错误: 错误 Execution failed for task ':compileTestJava'. > Could not resolve all files for configuration ':testCompileClasspath'. > Could not find org.apache.httpcomponent
Gradle
启动了一个Java项目,我已经将必要的Spring Boot
libs导入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.html
Build.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引导libs,以便查看Build.Gradle
文件中的问题所在
有人能推荐解决方案/帮助我解决这个问题吗?您的建议将不胜感激:)httpclient--1.2.5的版本看起来有点不对劲;最新版本是4.5.12。哦,那就更新版本isit吧?如果是这样的话,我会把它更新为兄弟。谢谢你的帮助