gpt4 book ai didi

eclipse - Groovy 版本不匹配在 Eclipse 中的 Gradle 项目中运行 spock 测试

转载 作者:行者123 更新时间:2023-12-02 16:53:05 27 4
gpt4 key购买 nike

我在 Eclipse Kepler 中有一个 Groovy 和 Gradle 项目,其中包含一些类和一个 Spock 规范。我可以从 shell 运行 Gradle 构建,并且运行良好,包括 Spock 规范。

我现在想尝试在 Eclipse 中运行 Spock 规范,无论是否在调试器中。当我运行它时,我看到以下内容:

Conflicting module versions. Module [groovy-all is loaded in version 2.3.9 and
you are trying to load version 2.3.10

这是我的 build.gradle 中的“依赖项” block :

dependencies {
compile localGroovy()
compile gradleApi()
compile "org.opendaylight.yangtools:yang-parser-impl:0.7.0-SNAPSHOT"
testCompile("org.spockframework:spock-core:1.0-groovy-2.3") {
exclude group: "org.codehaus.groovy"
}
}

我可以在 Project Explorer 中看到我的 Gradle 依赖项有 groovy-all-2.3.9.jar,我的 Groovy 依赖项有 groovy-all-2.3.10.jar。

这有点乱。我可以安全地编辑项目的 Groovy 依赖项并将 jar 更改为 2.3.9 版本吗?

更新:

这是命令行中的“groovy dependency”所说的内容。这与 Eclipse 使用的内容无关。

:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
+--- org.codehaus.groovy:groovy-all:2.3.9
\--- org.opendaylight.yangtools:yang-parser-impl:0.7.0-SNAPSHOT
+--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT
| +--- com.google.guava:guava:18.0
| +--- org.slf4j:slf4j-api:1.7.2
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| +--- org.slf4j:slf4j-api:1.7.2
| \--- com.google.guava:guava:18.0
+--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT (*)
| +--- org.opendaylight.yangtools:util:0.7.0-SNAPSHOT
| | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | +--- com.google.code.findbugs:jsr305:2.0.3
| | +--- org.slf4j:slf4j-api:1.7.2
| | +--- com.google.guava:guava:18.0
| | \--- com.github.romix:java-concurrent-hash-trie-map:0.2.23
| +--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT (*)
| +--- com.google.guava:guava:18.0
| \--- com.google.code.findbugs:jsr305:2.0.3
+--- org.opendaylight.yangtools:yang-parser-api:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
+--- org.opendaylight.yangtools:yang-model-util:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
+--- org.antlr:antlr4-runtime:4.0
| \--- org.abego.treelayout:org.abego.treelayout.core:1.0.1
+--- com.google.guava:guava:18.0
+--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
+--- commons-io:commons-io:2.4
\--- com.google.code.findbugs:jsr305:2.0.3

default - Configuration for default artifacts.
+--- org.codehaus.groovy:groovy-all:2.3.9
\--- org.opendaylight.yangtools:yang-parser-impl:0.7.0-SNAPSHOT
+--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT
| +--- com.google.guava:guava:18.0
| +--- org.slf4j:slf4j-api:1.7.2
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| +--- org.slf4j:slf4j-api:1.7.2
| \--- com.google.guava:guava:18.0
+--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT (*)
| +--- org.opendaylight.yangtools:util:0.7.0-SNAPSHOT
| | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | +--- com.google.code.findbugs:jsr305:2.0.3
| | +--- org.slf4j:slf4j-api:1.7.2
| | +--- com.google.guava:guava:18.0
| | \--- com.github.romix:java-concurrent-hash-trie-map:0.2.23
| +--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT (*)
| +--- com.google.guava:guava:18.0
| \--- com.google.code.findbugs:jsr305:2.0.3
+--- org.opendaylight.yangtools:yang-parser-api:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
+--- org.opendaylight.yangtools:yang-model-util:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
+--- org.antlr:antlr4-runtime:4.0
| \--- org.abego.treelayout:org.abego.treelayout.core:1.0.1
+--- com.google.guava:guava:18.0
+--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
+--- commons-io:commons-io:2.4
\--- com.google.code.findbugs:jsr305:2.0.3

runtime - Runtime classpath for source set 'main'.
+--- org.codehaus.groovy:groovy-all:2.3.9
\--- org.opendaylight.yangtools:yang-parser-impl:0.7.0-SNAPSHOT
+--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT
| +--- com.google.guava:guava:18.0
| +--- org.slf4j:slf4j-api:1.7.2
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| +--- org.slf4j:slf4j-api:1.7.2
| \--- com.google.guava:guava:18.0
+--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT (*)
| +--- org.opendaylight.yangtools:util:0.7.0-SNAPSHOT
| | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | +--- com.google.code.findbugs:jsr305:2.0.3
| | +--- org.slf4j:slf4j-api:1.7.2
| | +--- com.google.guava:guava:18.0
| | \--- com.github.romix:java-concurrent-hash-trie-map:0.2.23
| +--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT (*)
| +--- com.google.guava:guava:18.0
| \--- com.google.code.findbugs:jsr305:2.0.3
+--- org.opendaylight.yangtools:yang-parser-api:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
+--- org.opendaylight.yangtools:yang-model-util:0.7.0-SNAPSHOT
| \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
+--- org.antlr:antlr4-runtime:4.0
| \--- org.abego.treelayout:org.abego.treelayout.core:1.0.1
+--- com.google.guava:guava:18.0
+--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
+--- commons-io:commons-io:2.4
\--- com.google.code.findbugs:jsr305:2.0.3

testCompile - Compile classpath for source set 'test'.
+--- org.codehaus.groovy:groovy-all:2.3.9
+--- org.opendaylight.yangtools:yang-parser-impl:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT
| | +--- com.google.guava:guava:18.0
| | +--- org.slf4j:slf4j-api:1.7.2
| | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | \--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT
| | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | +--- org.slf4j:slf4j-api:1.7.2
| | \--- com.google.guava:guava:18.0
| +--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT
| | +--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT (*)
| | +--- org.opendaylight.yangtools:util:0.7.0-SNAPSHOT
| | | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | | +--- com.google.code.findbugs:jsr305:2.0.3
| | | +--- org.slf4j:slf4j-api:1.7.2
| | | +--- com.google.guava:guava:18.0
| | | \--- com.github.romix:java-concurrent-hash-trie-map:0.2.23
| | +--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT (*)
| | +--- com.google.guava:guava:18.0
| | \--- com.google.code.findbugs:jsr305:2.0.3
| +--- org.opendaylight.yangtools:yang-parser-api:0.7.0-SNAPSHOT
| | \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
| +--- org.opendaylight.yangtools:yang-model-util:0.7.0-SNAPSHOT
| | \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
| +--- org.antlr:antlr4-runtime:4.0
| | \--- org.abego.treelayout:org.abego.treelayout.core:1.0.1
| +--- com.google.guava:guava:18.0
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| +--- commons-io:commons-io:2.4
| \--- com.google.code.findbugs:jsr305:2.0.3
\--- org.spockframework:spock-core:1.0-groovy-2.3
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3

testRuntime - Runtime classpath for source set 'test'.
+--- org.codehaus.groovy:groovy-all:2.3.9
+--- org.opendaylight.yangtools:yang-parser-impl:0.7.0-SNAPSHOT
| +--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT
| | +--- com.google.guava:guava:18.0
| | +--- org.slf4j:slf4j-api:1.7.2
| | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | \--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT
| | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | +--- org.slf4j:slf4j-api:1.7.2
| | \--- com.google.guava:guava:18.0
| +--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT
| | +--- org.opendaylight.yangtools:object-cache-api:0.7.0-SNAPSHOT (*)
| | +--- org.opendaylight.yangtools:util:0.7.0-SNAPSHOT
| | | +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| | | +--- com.google.code.findbugs:jsr305:2.0.3
| | | +--- org.slf4j:slf4j-api:1.7.2
| | | +--- com.google.guava:guava:18.0
| | | \--- com.github.romix:java-concurrent-hash-trie-map:0.2.23
| | +--- org.opendaylight.yangtools:yang-common:0.7.0-SNAPSHOT (*)
| | +--- com.google.guava:guava:18.0
| | \--- com.google.code.findbugs:jsr305:2.0.3
| +--- org.opendaylight.yangtools:yang-parser-api:0.7.0-SNAPSHOT
| | \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
| +--- org.opendaylight.yangtools:yang-model-util:0.7.0-SNAPSHOT
| | \--- org.opendaylight.yangtools:yang-model-api:0.7.0-SNAPSHOT (*)
| +--- org.antlr:antlr4-runtime:4.0
| | \--- org.abego.treelayout:org.abego.treelayout.core:1.0.1
| +--- com.google.guava:guava:18.0
| +--- org.opendaylight.yangtools:concepts:0.7.0-SNAPSHOT
| +--- commons-io:commons-io:2.4
| \--- com.google.code.findbugs:jsr305:2.0.3
\--- org.spockframework:spock-core:1.0-groovy-2.3
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3

(*) - dependencies omitted (listed previously)

BUILD SUCCESSFUL

Total time: 2.041 secs

最佳答案

当使用 kepler 和 gradle 时,每个都将其 groovy 模块放在类路径上。我们不要使用开普勒的: enter image description here

关于eclipse - Groovy 版本不匹配在 Eclipse 中的 Gradle 项目中运行 spock 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28882642/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com