在Gradle
中运行Intellij-IDEA
程序时遇到错误。我不确定为什么会给我一个错误。我相信,在这种情况下,可能会弃用其中一个依赖项。请对此给予启发。谢谢。我在下面发布了 Error StackTrace 和 Build.Gradle 文件。
错误StackTrace
Execution failed for task ':compileTestJava'.
> Could not resolve all files for configuration ':testCompileClasspath'.
> Could not find android.arch.persistence.room:runtime:1.1.1.
Required by:
project :
Build.Gradle
plugins {
id 'org.springframework.boot' version '2.3.4.RELEASE'
}
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
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 {
implementation 'android.arch.persistence.room:runtime:1.1.1'
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: '4.5.12'
// 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'
// Importing ModelMapper Library for DTO
compile 'org.modelmapper:modelmapper:2.3.3'
// Importing Spring Boot Dependency
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
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}"
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junitVersion}"
implementation 'junit:junit:4.12'
//Lombok plugin for DTO
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
//MapStruct Mapper Framework for serialising DTO
implementation 'org.mapstruct:mapstruct:1.4.0.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.0.Final'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.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")
}
注意:我已经重新发布了Build.Gradle
文件。
答案 0 :(得分:0)
我认为答案是我的程序集中在DTO上,我遇到问题的依赖性与我的程序无关。
implementation 'android.arch.persistence.room:runtime:1.1.1'
实际上,依赖项包括android
作为依赖项的根词,它更适合Android
,这对我的DTO程序没有任何意义。
所以我要做的是将implementation 'android.arch.persistence.room:runtime:1.1.1'
和annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
一起删除。最终,该程序运行良好,因为我已经在使用MapStruct
注释处理器与DTO进行映射了。