Ich migrieren eine Java-Bibliothek zu Gradle 4.0-milestone2
und ich stieß auf einige Probleme mit der unten definierten Integration Aufgabe.Integrationstest auf Gradle 4.0-Meilenstein2
Diese Aufgabe erlaubt es mir, zwei Verzeichnisse unterschiedliche Quelle src/test
und src/integration
und verfügen über separate gradle Aufgaben zu haben, um sie auszuführen, ./gradlew test
und ./gradlew integration
.
Inhalt von integration.gradle
sourceSets {
integration {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration/java')
}
resources.srcDir file('src/integration/resources')
}
}
configurations {
integrationCompile.extendsFrom testCompile
integrationRuntime.extendsFrom testRuntime
}
idea {
module {
testSourceDirs += file('src/integration/java')
scopes.TEST.plus += [configurations.integrationCompile]
}
}
task integration(type: Test) {
testClassesDir = sourceSets.integration.output.classesDir
classpath = sourceSets.integration.runtimeClasspath
}
integration.mustRunAfter test
Inhalt von build.gradle
apply plugin: 'java-library'
apply plugin: 'idea'
apply from: './integration.gradle'
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
dependencies {
api 'com.github.ihsanbal:LoggingInterceptor:2.0.0'
api 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
api 'com.squareup.retrofit2:retrofit:2.0.2'
api 'com.squareup.retrofit2:converter-gson:2.0.2'
api 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
testImplementation 'junit:junit:4.12'
}
test {
testLogging.showStandardStreams = true
}
task copyTestResources(type: Copy) {
from sourceSets.test.resources
into sourceSets.test.output.classesDir
}
processTestResources.dependsOn copyTestResources
Es gibt zwei Probleme mit dieser Konfiguration.
1) copyTestResources
Aufgabe funktioniert nicht, classesDir
ist veraltet und classesDirs
ist nicht kompatibel.
2) Die Klassenpfade enthalten die Bibliotheksabhängigkeiten nicht. Compilation nicht voll der folgenden Fehler
error: cannot find symbol
error: package SOMETHING does not exist
Irgendwelche Hinweise auf, wie diese Probleme zu lösen? Danke