[英]Maven fails to run Grails Spock integration tests
For some reason the Maven Grails integration fails to run Spock (integration phase)* tests 由于某些原因,Maven Grails集成无法运行Spock(集成阶段)*测试
The tests are executed fine with the normal grails command grails test-app
, but the Maven version mvn grails:test-app
fails. 使用常规grails命令
grails test-app
可以很好地执行grails test-app
,但是Maven版本mvn grails:test-app
失败。 I've followed this example in the setup. 我在安装程序中遵循了此示例 。
My grails BuildConfig.groovy
has the following 我的Grails
BuildConfig.groovy
具有以下内容
dependencies {
// ... irrelevant dependencies omitted
test 'org.spockframework:spock-grails-support:0.7-groovy-2.0'
}
plugins {
// ... irrelevant plugins omitted
test(":spock:0.7") { exclude "spock-grails-support"
}
And the Maven pom.xml 和Maven pom.xml
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.grails</groupId>
<artifactId>grails-maven-plugin</artifactId>
<version>${grails.version}</version>
<configuration>
<fork>true</fork>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.spockframework</groupId>
<artifactId>spock-maven</artifactId>
<version>${spock.version}</version>
<executions>
<execution>
<goals>
<goal>find-specs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
where Grails version is 2.2.4 and Spock version is 0.7-groovy-2.0 其中Grails版本为2.2.4 , Spock版本为0.7-groovy-2.0
The bottom line is that the Spock tests just don't get executed at all. 最重要的是, Spock测试根本不会执行。 What's up with that?
那是怎么回事?
* So far only have written integration phase tests with Spock *到目前为止,只有Spock具有书面的集成阶段测试
Plugin dependencies should be specified in pom.xml
instead of BuildConfig
in mavenized projects. 插件依赖项应该在
pom.xml
中指定,而不是在Mavenized项目中指定BuildConfig
。 Replace entries for spock in BuildConfig
(remove spock plugin and the dependency to the support jar as well) with the below entry in pom.xml
. 用以下
pom.xml
中的条目替换BuildConfig
中spock的条目(也删除spock插件和对支持jar的依赖项)。
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>spock</artifactId>
<version>0.7</version>
<scope>runtime</scope>
<type>zip</type>
<exclusions>
<exclusion>
<groupId>org.spockframework</groupId>
<artifactId>spock-grails-support</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-grails-support</artifactId>
<version>0.7-groovy-2.0</version>
<scope>runtime</scope>
</dependency>
You would not need spock-maven
maven pluing as well, I suppose 我想你也不需要
spock-maven
Maven插件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.