我想将测试包打包到jar文件中。如何从Maven插件Surefire执行生成测试包
您可以在pom中添加以下条目:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin>
通过使用以下配置,您可以从测试中创建一个jar:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin>
要使用这种工件:
<dependencies> <dependency> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <type>test-jar</type> <version>version</version> <classifier>tests</classifier> <scope>test</scope> </dependency> </dependencies>