当前位置: 首页 > 知识库问答 >
问题:

如何解决Gradle中的传递依赖冲突

马渊
2023-03-14
// Write the plugin's classpath to a file to share with the tests
task pluginUnderTestMetadata {
    def outputDir = file("${buildDir}/pluginUnderTestMetadata")
    def runtimeClasspath = sourceSets.main.runtimeClasspath

    outputs.dir(outputDir)
        .withPropertyName("outputDir")

        inputs.files(runtimeClasspath)
                .withPropertyName("runtimeClasspath")
                .withNormalizer(ClasspathNormalizer)


    doLast {
        outputDir.mkdirs()
        file("$outputDir/plugin-classpath.txt").text = runtimeClasspath.join("\n")
    }
}

dependencies {
    implementation localGroovy(),
            gradleApi(),
            project(':waweb.site.plugin'),
            project(':waweb.site.plugin.js'),
            project(':waweb.site.plugin.sass'),
            project(':waweb.site.plugin.template'),
            project(':waweb.site.plugin.war')

    testRuntimeOnly files(pluginUnderTestMetadata)
    testImplementation gradleTestKit(),
            "junit:junit:${JUNIT_VER}",
            "org.assertj:assertj-core:${ASSERTJ_VER}",
            "org.hamcrest:hamcrest:${HAMCREST_VER}",
            "net.serenity-bdd:serenity-core:${SERENITY_VER}",
            "net.serenity-bdd:serenity-junit:${SERENITY_VER}",
            "net.serenity-bdd:serenity-cucumber:${SERENITY_CUCUMBER_VER}"
}
1) Error injecting constructor, java.lang.NoSuchMethodError: com.google.gson.Gson.<init>(Lcom/google/gson/internal/Excluder;Lcom/google/gson/FieldNamingStrategy;Ljava/util/Map;ZZZZZZZLcom/google/gson/LongSerializationPolicy;Ljava/lang/String;IILjava/util/List;Ljava/util/List;Ljava/util/List;)V
at net.thucydides.core.reports.json.gson.GsonJSONConverter.<init>(GsonJSONConverter.java:38)
while locating net.thucydides.core.reports.json.gson.GsonJSONConverter
at net.thucydides.core.guice.ThucydidesModule.configure(ThucydidesModule.java:56)
while locating net.thucydides.core.reports.json.JSONConverter
at net.serenitybdd.core.history.FileSystemTestOutcomeSummaryRecorder.<init>(FileSystemTestOutcomeSummaryRecorder.java:42)
while locating net.serenitybdd.core.history.FileSystemTestOutcomeSummaryRecorder
at net.thucydides.core.guice.ThucydidesModule.configure(ThucydidesModule.java:72)
while locating net.serenitybdd.core.history.TestOutcomeSummaryRecorder
    for the 2nd parameter of net.serenitybdd.core.history.HistoricalFlagProvider.<init>(HistoricalFlagProvider.java:28)
while locating net.serenitybdd.core.history.HistoricalFlagProvider
at net.thucydides.core.guice.ThucydidesModule.configure(ThucydidesModule.java:71)
while locating net.thucydides.core.model.flags.FlagProvider

删节依赖关系报告

runtimeClasspath - Runtime classpath of source set 'main'.
+--- project :waweb.site.plugin
|    \--- org.codehaus.groovy:groovy-all:2.5.8
[SNIP GROOVY DEPS...]
+--- project :waweb.site.plugin.js
|    +--- org.codehaus.groovy:groovy-all:2.5.8 (*)
|    +--- com.google.javascript:closure-compiler:v20191111
|    |    +--- com.google.javascript:closure-compiler-externs:v20191111
|    |    +--- args4j:args4j:2.0.26
|    |    +--- com.google.errorprone:error_prone_annotations:2.3.1
|    |    +--- com.google.guava:guava:25.1-jre
|    |    |    +--- com.google.code.findbugs:jsr305:3.0.2
|    |    |    +--- org.checkerframework:checker-qual:2.0.0
|    |    |    +--- com.google.errorprone:error_prone_annotations:2.1.3 -> 2.3.1
|    |    |    +--- com.google.j2objc:j2objc-annotations:1.1
|    |    |    \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
|    |    +--- com.google.protobuf:protobuf-java:3.0.2
|    |    +--- com.google.code.gson:gson:2.7
|    |    +--- com.google.code.findbugs:jsr305:3.0.1 -> 3.0.2
|    |    +--- com.google.jsinterop:jsinterop-annotations:1.0.2
|    |    +--- com.google.jsinterop:base:1.0.0
|    |    |    \--- com.google.jsinterop:jsinterop-annotations:1.0.2
|    |    +--- com.google.elemental2:elemental2-core:1.0.0-RC1
|    |    |    +--- com.google.jsinterop:jsinterop-annotations:1.0.2
|    |    |    \--- com.google.jsinterop:base:1.0.0-RC1 -> 1.0.0 (*)
|    |    \--- com.google.re2j:re2j:1.3
|    \--- project :waweb.site.plugin (*)

testCompileClasspath - Compile classpath for source set 'test'.
+--- project :waweb.site.plugin
+--- project :waweb.site.plugin.js
+--- project :waweb.site.plugin.sass
+--- project :waweb.site.plugin.template
+--- project :waweb.site.plugin.war
+--- junit:junit:4.12
|    \--- org.hamcrest:hamcrest-core:1.3
+--- org.assertj:assertj-core:3.14.0
+--- org.hamcrest:hamcrest:2.2
+--- net.serenity-bdd:serenity-core:2.0.90
|    +--- net.bytebuddy:byte-buddy:1.10.1
|    +--- net.bytebuddy:byte-buddy-agent:1.10.1
|    +--- com.google.guava:guava:25.0-jre
|    |    +--- com.google.code.findbugs:jsr305:1.3.9
|    |    +--- org.checkerframework:checker-compat-qual:2.0.0
|    |    +--- com.google.errorprone:error_prone_annotations:2.1.3
|    |    +--- com.google.j2objc:j2objc-annotations:1.1
|    |    \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
|    +--- com.google.inject:guice:4.2.2
|    |    +--- javax.inject:javax.inject:1
|    |    \--- aopalliance:aopalliance:1.0
|    +--- org.ow2.asm:asm:7.2
|    +--- commons-codec:commons-codec:1.10
|    +--- org.objenesis:objenesis:3.0.1
|    +--- org.slf4j:slf4j-api:1.7.26
|    +--- xml-apis:xml-apis:1.4.01
|    +--- io.cucumber:cucumber-core:2.4.0
|    |    +--- info.cukes:cucumber-html:0.2.6
|    |    +--- io.cucumber:cucumber-jvm-deps:1.0.6
|    |    +--- io.cucumber:gherkin:5.0.0
|    |    \--- io.cucumber:tag-expressions:1.1.1
|    +--- commons-logging:commons-logging:1.2
|    +--- io.vavr:vavr:0.9.0
|    |    \--- io.vavr:vavr-match:0.9.0
|    +--- javax.xml.bind:jaxb-api:2.2.12
|    +--- com.sun.xml.bind:jaxb-core:2.3.0.1
|    +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
|    +--- javax.activation:activation:1.1.1
|    +--- org.mockito:mockito-core:3.1.0
|    +--- net.serenity-bdd:serenity-report-resources:2.0.90
|    |    +--- net.bytebuddy:byte-buddy:1.10.1
|    |    +--- net.bytebuddy:byte-buddy-agent:1.10.1
|    |    +--- com.google.guava:guava:25.0-jre (*)
|    |    +--- com.google.inject:guice:4.2.2 (*)
|    |    +--- org.ow2.asm:asm:7.2
|    |    +--- commons-codec:commons-codec:1.10
|    |    +--- org.objenesis:objenesis:3.0.1
|    |    +--- org.slf4j:slf4j-api:1.7.26
|    |    +--- xml-apis:xml-apis:1.4.01
|    |    +--- io.cucumber:cucumber-core:2.4.0 (*)
|    |    +--- commons-logging:commons-logging:1.2
|    |    +--- io.vavr:vavr:0.9.0 (*)
|    |    +--- javax.xml.bind:jaxb-api:2.2.12
|    |    +--- com.sun.xml.bind:jaxb-core:2.3.0.1
|    |    +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
|    |    +--- javax.activation:activation:1.1.1
|    |    \--- org.mockito:mockito-core:3.1.0
|    +--- net.serenity-bdd:serenity-model:2.0.90
|    |    +--- net.bytebuddy:byte-buddy:1.10.1
|    |    +--- net.bytebuddy:byte-buddy-agent:1.10.1
|    |    +--- com.google.guava:guava:25.0-jre (*)
|    |    +--- com.google.inject:guice:4.2.2 (*)
|    |    +--- org.ow2.asm:asm:7.2
|    |    +--- commons-codec:commons-codec:1.10
|    |    +--- org.objenesis:objenesis:3.0.1
|    |    +--- org.slf4j:slf4j-api:1.7.26
|    |    +--- xml-apis:xml-apis:1.4.01
|    |    +--- io.cucumber:cucumber-core:2.4.0 (*)
|    |    +--- commons-logging:commons-logging:1.2
|    |    +--- io.vavr:vavr:0.9.0 (*)
|    |    +--- javax.xml.bind:jaxb-api:2.2.12
|    |    +--- com.sun.xml.bind:jaxb-core:2.3.0.1
|    |    +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
|    |    +--- javax.activation:activation:1.1.1
|    |    +--- org.mockito:mockito-core:3.1.0
|    |    +--- net.serenity-bdd:serenity-report-resources:2.0.90 (*)
|    |    +--- org.apache.commons:commons-lang3:3.8.1
|    |    +--- commons-net:commons-net:3.6
|    |    +--- com.typesafe:config:1.3.1
|    |    +--- org.jsoup:jsoup:1.10.3
|    |    +--- joda-time:joda-time:2.7
|    |    +--- commons-collections:commons-collections:3.2.2
|    |    +--- commons-io:commons-io:2.6
|    |    +--- org.apache.commons:commons-text:1.6 -> 1.7
|    |    +--- commons-beanutils:commons-beanutils-core:1.8.3
|    |    +--- net.sf.opencsv:opencsv:2.0
|    |    +--- com.google.code.gson:gson:2.8.4
|    |    +--- org.imgscalr:imgscalr-lib:4.2
|    |    +--- com.thoughtworks.xstream:xstream:1.4.9
|    |    |    +--- xmlpull:xmlpull:1.1.3.1
|    |    |    \--- xpp3:xpp3_min:1.1.4c
|    |    +--- org.codehaus.groovy:groovy:2.5.5
|    |    +--- net.sourceforge.jexcelapi:jxl:2.6.12
|    |    +--- org.awaitility:awaitility:4.0.1
|    |    |    \--- org.hamcrest:hamcrest:2.1 -> 2.2
|    |    +--- org.asciidoctor:asciidoctorj:1.5.6
|    |    +--- org.freemarker:freemarker:2.3.28
|    |    +--- com.vladsch.flexmark:flexmark-all:0.34.30
[SNIP FLEXMARK DEPS...]
|    |    \--- es.nitaur.markdown:txtmark:0.16
|    +--- net.serenity-bdd:serenity-reports:2.0.90
|    |    +--- net.bytebuddy:byte-buddy:1.10.1
|    |    +--- net.bytebuddy:byte-buddy-agent:1.10.1
|    |    +--- com.google.guava:guava:25.0-jre (*)
|    |    +--- com.google.inject:guice:4.2.2 (*)
|    |    +--- org.ow2.asm:asm:7.2
|    |    +--- commons-codec:commons-codec:1.10
|    |    +--- org.objenesis:objenesis:3.0.1
|    |    +--- org.slf4j:slf4j-api:1.7.26
|    |    +--- xml-apis:xml-apis:1.4.01
|    |    +--- io.cucumber:cucumber-core:2.4.0 (*)
|    |    +--- commons-logging:commons-logging:1.2
|    |    +--- io.vavr:vavr:0.9.0 (*)
|    |    +--- javax.xml.bind:jaxb-api:2.2.12
|    |    +--- com.sun.xml.bind:jaxb-core:2.3.0.1
|    |    +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
|    |    +--- javax.activation:activation:1.1.1
|    |    +--- org.mockito:mockito-core:3.1.0
|    |    +--- net.serenity-bdd:serenity-model:2.0.90 (*)
|    |    \--- net.serenity-bdd:serenity-stats:2.0.90
|    |         +--- net.bytebuddy:byte-buddy:1.10.1
|    |         +--- net.bytebuddy:byte-buddy-agent:1.10.1
|    |         +--- com.google.guava:guava:25.0-jre (*)
|    |         +--- com.google.inject:guice:4.2.2 (*)
|    |         +--- org.ow2.asm:asm:7.2
|    |         +--- commons-codec:commons-codec:1.10
|    |         +--- org.objenesis:objenesis:3.0.1
|    |         +--- org.slf4j:slf4j-api:1.7.26
|    |         +--- xml-apis:xml-apis:1.4.01
|    |         +--- io.cucumber:cucumber-core:2.4.0 (*)
|    |         +--- commons-logging:commons-logging:1.2
|    |         +--- io.vavr:vavr:0.9.0 (*)
|    |         +--- javax.xml.bind:jaxb-api:2.2.12
|    |         +--- com.sun.xml.bind:jaxb-core:2.3.0.1
|    |         +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
|    |         +--- javax.activation:activation:1.1.1
|    |         +--- org.mockito:mockito-core:3.1.0
|    |         +--- net.serenity-bdd:serenity-model:2.0.90 (*)
|    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
|    |              +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
|    |              \--- org.jetbrains:annotations:13.0
|    +--- com.google.code.gson:gson:2.8.4
|    +--- commons-io:commons-io:2.6
|    +--- org.seleniumhq.selenium:selenium-server:3.141.59
[SNIP SELENIUM DEPS]
|    +--- com.paulhammant:ngwebdriver:1.1.4
|    +--- com.codeborne:phantomjsdriver:1.4.4
|    +--- org.seleniumhq.selenium:htmlunit-driver:2.36.0
|    |    \--- net.sourceforge.htmlunit:htmlunit:2.36.0
|    |         +--- xalan:xalan:2.7.2
|    |         |    \--- xalan:serializer:2.7.2
|    |         |         \--- xml-apis:xml-apis:1.3.04 -> 1.4.01
|    |         +--- org.apache.commons:commons-text:1.7
|    |         +--- org.apache.httpcomponents:httpmime:4.5.9
|    |         |    \--- org.apache.httpcomponents:httpclient:4.5.9
|    |         |         +--- org.apache.httpcomponents:httpcore:4.4.11
|    |         |         \--- commons-logging:commons-logging:1.2
|    |         +--- net.sourceforge.htmlunit:htmlunit-core-js:2.36.0
|    |         +--- net.sourceforge.htmlunit:neko-htmlunit:2.36.0
|    |         |    \--- xerces:xercesImpl:2.12.0
|    |         |         \--- xml-apis:xml-apis:1.4.01
|    |         +--- net.sourceforge.htmlunit:htmlunit-cssparser:1.5.0
|    |         +--- commons-io:commons-io:2.6
|    |         +--- commons-logging:commons-logging:1.2
|    |         +--- commons-net:commons-net:3.6
|    |         +--- org.brotli:dec:0.1.2
|    |         \--- org.eclipse.jetty.websocket:websocket-client:9.4.20.v20190813
|    |              +--- org.eclipse.jetty:jetty-client:9.4.20.v20190813
|    |              |    +--- org.eclipse.jetty:jetty-http:9.4.20.v20190813
|    |              |    |    +--- org.eclipse.jetty:jetty-util:9.4.20.v20190813
|    |              |    |    \--- org.eclipse.jetty:jetty-io:9.4.20.v20190813
|    |              |    |         \--- org.eclipse.jetty:jetty-util:9.4.20.v20190813
|    |              |    \--- org.eclipse.jetty:jetty-io:9.4.20.v20190813 (*)
|    |              +--- org.eclipse.jetty:jetty-xml:9.4.20.v20190813
|    |              |    \--- org.eclipse.jetty:jetty-util:9.4.20.v20190813
|    |              +--- org.eclipse.jetty:jetty-util:9.4.20.v20190813
|    |              +--- org.eclipse.jetty:jetty-io:9.4.20.v20190813 (*)
|    |              \--- org.eclipse.jetty.websocket:websocket-common:9.4.20.v20190813
|    |                   +--- org.eclipse.jetty.websocket:websocket-api:9.4.20.v20190813
|    |                   +--- org.eclipse.jetty:jetty-util:9.4.20.v20190813
|    |                   \--- org.eclipse.jetty:jetty-io:9.4.20.v20190813 (*)
|    +--- io.appium:java-client:7.2.0
|    |    +--- commons-validator:commons-validator:1.6
|    |    |    +--- commons-beanutils:commons-beanutils:1.9.2
|    |    |    |    \--- commons-collections:commons-collections:3.2.1 -> 3.2.2
|    |    |    +--- commons-digester:commons-digester:1.8.1
|    |    |    \--- commons-collections:commons-collections:3.2.2
|    |    +--- org.aspectj:aspectjweaver:1.9.4
|    |    \--- org.slf4j:slf4j-api:1.7.26
|    +--- org.springframework:spring-context-support:5.1.2.RELEASE
|    |    +--- org.springframework:spring-beans:5.1.2.RELEASE
|    |    |    \--- org.springframework:spring-core:5.1.2.RELEASE
|    |    |         \--- org.springframework:spring-jcl:5.1.2.RELEASE
|    |    +--- org.springframework:spring-context:5.1.2.RELEASE
|    |    |    +--- org.springframework:spring-aop:5.1.2.RELEASE
|    |    |    |    +--- org.springframework:spring-beans:5.1.2.RELEASE (*)
|    |    |    |    \--- org.springframework:spring-core:5.1.2.RELEASE (*)
|    |    |    +--- org.springframework:spring-beans:5.1.2.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:5.1.2.RELEASE (*)
|    |    |    \--- org.springframework:spring-expression:5.1.2.RELEASE
|    |    |         \--- org.springframework:spring-core:5.1.2.RELEASE (*)
|    |    \--- org.springframework:spring-core:5.1.2.RELEASE (*)
|    +--- org.codehaus.groovy:groovy:2.5.5
|    +--- net.sf.opencsv:opencsv:2.0
|    +--- commons-beanutils:commons-beanutils-core:1.8.3
|    +--- joda-time:joda-time:2.7
|    +--- com.thoughtworks.xstream:xstream:1.4.9 (*)
|    +--- org.apache.commons:commons-lang3:3.8.1
|    +--- commons-collections:commons-collections:3.2.2
|    +--- org.freemarker:freemarker:2.3.28
|    +--- net.sourceforge.jexcelapi:jxl:2.6.12
|    +--- org.hamcrest:hamcrest-core:1.3
|    +--- org.hamcrest:hamcrest-library:1.3
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- net.sourceforge.htmlunit:htmlunit:2.36.0 (*)
|    +--- org.apache.httpcomponents:httpclient:4.5.5 -> 4.5.9 (*)
|    +--- org.apache.httpcomponents:httpmime:4.5.5 -> 4.5.9 (*)
|    +--- org.fluentlenium:fluentlenium-core:0.10.2
|    +--- com.jhlabs:filters:2.0.235
|    +--- org.asciidoctor:asciidoctorj:1.5.6
|    +--- org.imgscalr:imgscalr-lib:4.2
|    +--- javax.el:javax.el-api:2.2.4
|    +--- org.glassfish.web:javax.el:2.2.4
|    |    \--- javax.el:javax.el-api:2.2.4
|    +--- xalan:xalan:2.7.2 (*)
|    +--- xalan:serializer:2.7.2 (*)
|    +--- org.awaitility:awaitility:4.0.1 (*)
|    +--- com.typesafe:config:1.3.1
|    +--- org.jsoup:jsoup:1.10.3
|    +--- com.google.jimfs:jimfs:1.1
|    \--- com.vladsch.flexmark:flexmark-all:0.34.30 (*)
+--- net.serenity-bdd:serenity-junit:2.0.90
|    +--- net.bytebuddy:byte-buddy:1.10.1
|    +--- net.bytebuddy:byte-buddy-agent:1.10.1
|    +--- com.google.guava:guava:25.0-jre (*)
|    +--- com.google.inject:guice:4.2.2 (*)
|    +--- org.ow2.asm:asm:7.2
|    +--- commons-codec:commons-codec:1.10
|    +--- org.objenesis:objenesis:3.0.1
|    +--- org.slf4j:slf4j-api:1.7.26
|    +--- xml-apis:xml-apis:1.4.01
|    +--- io.cucumber:cucumber-core:2.4.0 (*)
|    +--- commons-logging:commons-logging:1.2
|    +--- io.vavr:vavr:0.9.0 (*)
|    +--- javax.xml.bind:jaxb-api:2.2.12
|    +--- com.sun.xml.bind:jaxb-core:2.3.0.1
|    +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
|    +--- javax.activation:activation:1.1.1
|    +--- org.mockito:mockito-core:3.1.0
|    +--- net.serenity-bdd:serenity-model:2.0.90 (*)
|    +--- net.serenity-bdd:serenity-core:2.0.90 (*)
|    +--- junit:junit:4.12 (*)
|    \--- org.hamcrest:hamcrest-core:1.3
\--- net.serenity-bdd:serenity-cucumber:1.9.49
    +--- net.serenity-bdd:serenity-core:2.0.90 (*)
    +--- net.serenity-bdd:serenity-screenplay:2.0.90
    |    +--- net.bytebuddy:byte-buddy:1.10.1
    |    +--- net.bytebuddy:byte-buddy-agent:1.10.1
    |    +--- com.google.guava:guava:25.0-jre (*)
    |    +--- com.google.inject:guice:4.2.2 (*)
    |    +--- org.ow2.asm:asm:7.2
    |    +--- commons-codec:commons-codec:1.10
    |    +--- org.objenesis:objenesis:3.0.1
    |    +--- org.slf4j:slf4j-api:1.7.26
    |    +--- xml-apis:xml-apis:1.4.01
    |    +--- io.cucumber:cucumber-core:2.4.0 (*)
    |    +--- commons-logging:commons-logging:1.2
    |    +--- io.vavr:vavr:0.9.0 (*)
    |    +--- javax.xml.bind:jaxb-api:2.2.12
    |    +--- com.sun.xml.bind:jaxb-core:2.3.0.1
    |    +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
    |    +--- javax.activation:activation:1.1.1
    |    +--- org.mockito:mockito-core:3.1.0
    |    \--- net.serenity-bdd:serenity-core:2.0.90 (*)
    +--- net.serenity-bdd:serenity-screenplay-webdriver:2.0.90
    |    +--- net.bytebuddy:byte-buddy:1.10.1
    |    +--- net.bytebuddy:byte-buddy-agent:1.10.1
    |    +--- com.google.guava:guava:25.0-jre (*)
    |    +--- com.google.inject:guice:4.2.2 (*)
    |    +--- org.ow2.asm:asm:7.2
    |    +--- commons-codec:commons-codec:1.10
    |    +--- org.objenesis:objenesis:3.0.1
    |    +--- org.slf4j:slf4j-api:1.7.26
    |    +--- xml-apis:xml-apis:1.4.01
    |    +--- io.cucumber:cucumber-core:2.4.0 (*)
    |    +--- commons-logging:commons-logging:1.2
    |    +--- io.vavr:vavr:0.9.0 (*)
    |    +--- javax.xml.bind:jaxb-api:2.2.12
    |    +--- com.sun.xml.bind:jaxb-core:2.3.0.1
    |    +--- com.sun.xml.bind:jaxb-impl:2.3.0.1
    |    +--- javax.activation:activation:1.1.1
    |    +--- org.mockito:mockito-core:3.1.0
    |    +--- net.serenity-bdd:serenity-core:2.0.90 (*)
    |    \--- net.serenity-bdd:serenity-screenplay:2.0.90 (*)
    +--- io.cucumber:cucumber-java:2.4.0
    |    \--- io.cucumber:cucumber-core:2.4.0 (*)
    +--- io.cucumber:cucumber-junit:2.4.0
    |    \--- io.cucumber:cucumber-core:2.4.0 (*)
    +--- commons-logging:commons-logging:1.2
    +--- org.apache.commons:commons-csv:1.5
    +--- junit:junit:4.12 (*)
    \--- com.google.code.gson:gson:2.8.4

共有1个答案

钱毅
2023-03-14

我真的应该等24小时再发帖,因为当我想到其他事情时,答案总是随机出现在我的脑海中。

解决方案:

configurations {
    pluginsUnderTest
}

task pluginUnderTestMetadata {
    def outputDir = file("${buildDir}/pluginUnderTestMetadata")
    def runtimeClasspath = configurations.pluginsUnderTest

    outputs.dir(outputDir)
        .withPropertyName("outputDir")

    inputs.files(runtimeClasspath)
            .withPropertyName("runtimeClasspath")
            .withNormalizer(ClasspathNormalizer)


    doLast {
        outputDir.mkdirs()
        file("$outputDir/plugin-classpath.txt").text = runtimeClasspath.join("\n")
    }
}

dependencies {
    pluginsUnderTest localGroovy(),
            gradleApi(),
            project(':waweb.site.plugin'),
            project(':waweb.site.plugin.js'),
            project(':waweb.site.plugin.sass'),
            project(':waweb.site.plugin.template'),
            project(':waweb.site.plugin.war')

    testRuntimeOnly files(pluginUnderTestMetadata)
    testImplementation gradleTestKit(),
            "junit:junit:${JUNIT_VER}",
            "org.assertj:assertj-core:${ASSERTJ_VER}",
            "org.hamcrest:hamcrest:${HAMCREST_VER}",
            "net.serenity-bdd:serenity-core:${SERENITY_VER}",
            "net.serenity-bdd:serenity-junit:${SERENITY_VER}",
            "net.serenity-bdd:serenity-cucumber:${SERENITY_CUCUMBER_VER}"
}

希望这将至少节省一些时间,如果任何人希望建立功能测试的各种配置的插件项目。

 类似资料:
  • TL;DR两个gradle插件使用相同依赖项的不同版本,在调用其中一个插件时会导致编译错误。 > 我有一个使用Gradle4编译的Java项目。十、 该项目依赖于两个插件:gradle-jaxb-plugin和serenity-gradle-plugin。 两个插件共享一个依赖项,guice。 我需要升级一个插件(serenety)。升级会导致调用jaxb插件时发生冲突。 我做了一些调查和谷歌搜索

  • 我有一个相当大的遗留项目,我正在添加一个组件。此组件使用HtmlUnit。我可以用Maven编译它,但是当我运行它时,我得到: 所以它缺少正确的构造函数。我认为这几乎肯定是中的版本冲突,但我不确定如何解决它。下面是我的(请注意我一直尝试玩的排除和依赖关系管理的所有游戏): 有什么想法吗? 编辑:有人认为这个问题是这个问题的重复,但事实并非如此,因为本例中的依赖类型不是。

  • 我在intellij工作,使用spring boot和gradle。 我有一个使用其他两个库的服务,我似乎遇到了一些传递依赖性问题。 该服务中的spring boot版本已从2.1.2更新到2.1.4,这使得该服务不再工作。 我能够在gradle中干净地构建这个项目,但是一旦我启动它,在运行时我得到…无法解决org.slf4j: slf4j-api: 1.7.26。 我按照要求手动将库中的 slf

  • 我们有一个项目a依赖于项目B,项目B依赖于图书馆C。a和B是本地项目,而C是maven central repo的公共图书馆。 波姆。xml用于: 波姆。用于B的xml: 在A中运行mvn dependency:tree-Dverbose时,它不会解析B的依赖项,B中使用的此类依赖项也不会显示在A的Maven依赖项中。这对于编译很好,但在运行时会因为NoClassDefFound错误而失败。 有没

  • 问题内容: 我正在将Java项目从Ant迁移到Gradle。我认为最好的解决方案是使用Gradle的多项目支持,但是我找不到摆脱循环依赖的方法。 原始项目已设置为具有以下布局: 之间的关系,并且,是棘手的。将取决于或根据配置文件。同样,无论配置属性如何,都依赖和。并且永远不会在同一时间建造。 我认为一种快速的解决方案是在: 接下来,我想过要找到一种方法来使之更接近公正工作。这导致我想到了这一点:

  • null 使用Jenkins Artifactory插件,我能够将这两个模块的JAR发布到Artifactory,但我的另一个依赖于的项目未能构建,出现以下gradle错误 找不到com.mygroup:lib-api:1.0.0-snapshot lib-api/build.gradle null null 我的理解是,ArtiFactory/Gradle应该足够聪明,能够将解析为最新的时间戳快