我有一个Groovy和Gradle项目在Eclipse开普勒有几个类和一个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
这是我构建的“依赖项”块。格雷德尔:
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。罐子
这有点乱。我可以安全地编辑项目的Groovy依赖项并将jar更改为2.3.9版本吗?
更新:
以下是命令行中的“groovy依赖项”所说的。这与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
我建议使用下面的依赖项,而不是localGroovy()
,以避免团队成员遇到麻烦。让依赖关系管理对gradle起作用
compile "org.codehaus.groovy:groovy-all:2.3.9"
编辑01选中此链接,以切换de groovy版本http://groovy.codehaus.org/Compiler在Groovy Eclipse中切换
我错过了什么? 编辑: 看来Gradle也不接我的测试。当我转到时,它指示0 test。 在IntelliJ中,我打开Gradle窗口,点击“刷新所有Gradle项目”按钮,刷新库。 然后在我的测试类中,我在类声明的顶部添加了。 当我执行时,结果可以在下面找到:
我在Spring控制器中加载数据库驱动pec.groovymethod.but我不知道如何调用Groovy脚本中的方法。有人能给我建议吗? 带着导游http://docs.groovy-lang.org/latest/html/documentation/guide-integrating.html 我只想访问http://127.0.0.1:8080/spock/test/spock然后运行数据
在Windows机器上,我在Eclipse的Gradle项目中使用Groovy已有一段时间了。现在我正在尝试为Linux机器进行配置。(Linux Mint MATE)<代码>uname-a给出: Linuxmike-纬度-E6410 4.4.0-53-通用#74-Ubuntu SMP Fri Dec 2 15:58:04 UTC 2016 i686 i686 GNU/Linux 日蚀氧气。使用以
经过一些谷歌搜索,我没有找到什么地方,决定玩一下,发现如果我执行所有测试,它会运行良好,即使当我改变类名以匹配文件名时,它也会工作。是否有一种方法可以配置Eclipse/JUnit,使其能够在与文件名不匹配的groovy类上运行测试? HelloWorld.groovy:
我创建了maven项目,它由junit和spock测试组成。两个测试的代码。 在我的本地机器中,当我运行mvn测试时,它会欺骗两个测试类。我在git仓库上部署了项目,并为maven项目配置了jenkins。我推这个项目的存储库和执行作业,但是詹金斯只检测JUnit测试的AppTest类。我已经改变了pom.xml并添加了文件regadring到。我的项目结构。 文件组织的内容。spockframe
在我的多项目中,我正在根项目上运行测试任务,并期望它将在子项目上运行测试任务并生成一个测试报告。我观察到的是,它从来没有在子项目上运行测试任务。我的期望是不正确的吗?“我需要在我的gradle脚本中进行任何特殊配置吗? 请注意,我的根项目中没有测试。