Compile Groovy/Spock with GMavenPlus

Posted 天道酬勤

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Compile Groovy/Spock with GMavenPlus相关的知识,希望对你有一定的参考价值。

之前的博文里曾使用GMaven插件编译Groovy/Spock,这次使用GMavenplus插件,更加方便。

具体步骤

1. 导入Spock和Groovy依赖

<dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>1.0-groovy-2.4</version>
            <scope>test</scope>
        </dependency>
        <!-- http://mvnrepository.com/artifact/org.spockframework/spock-spring -->
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-spring</artifactId>
            <version>1.0-groovy-2.4</version>
        </dependency>

 

2.配置GMavenPlus

<plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
View Code

 

3.配置surefire plugin

 <plugin>
                <artifactId>maven-surefire-plugin</artifactId>

                <configuration>
                    <testFailureIgnore>false</testFailureIgnore>
                    <includes>
                        <include>**/*Spec.java</include>
                        <!-- Yes, .java extension -->
                        <include>**/*Test.java</include>
                        <!-- Just in case of having also "normal" JUnit tests -->
                    </includes>
                </configuration>
            </plugin>
View Code

 

以上是关于Compile Groovy/Spock with GMavenPlus的主要内容,如果未能解决你的问题,请参考以下文章

Groovy Spock环境的安装

Groovy/Spock 测试导论

使用Groovy+Spock轻松写出更简洁的单测

[每日一学]apache camel|BDD方式开发apache camel|Groovy|Spock

Groovy&Spock - 使用@ Slf4j AST标记,检测日志记录活动

[编译原理]用BDD方式开发lisp解释器(编译器)|开发语言java|Groovy|Spock