简体   繁体   中英

Gradle execution failed for task ':compileTestJava'

I have encountered an error when running my Gradle program in Intellij-IDEA . I'm unsure why it gave me an error. I believe one of the dependencies might be deprecated if that's the case. Please enlighten me on this. Thanks. I have posted the Error StackTrace and Build.Gradle files below.

Error 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")
}

Note: I have re-posted the Build.Gradle file.

The answer that I thought was that my program focuses on DTO which the dependency that I had an issue with has got nothing to do with my program.

implementation 'android.arch.persistence.room:runtime:1.1.1'

In fact, the dependency includes android as the root word for the dependency which is more catered towards Android which doesn't make any sense with my DTO Program.

So what I did was to remove implementation 'android.arch.persistence.room:runtime:1.1.1' together with annotationProcessor 'android.arch.persistence.room:compiler:1.1.1' . Eventually, the program works fine as I'm already using the MapStruct Annotation Processor to do mapping with DTO.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM