使用maven build helper插件的
add-test-source目标将生成的测试源文件添加到build->
http://mojo.prehaus.org/build-helper-maven-plugin/add-test-source-
mojo.html
它确保
test-compile在构建阶段,编译器插件会自动选择此目标添加的目录。
编辑
这是如何使用cxf-pregen-plugin为testign生成代码的示例
<build> <plugins> ... <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-pregen-plugin</artifactId> <version>${cxf.version}</version> <executions> <execution> <id>generate-test-sources</id> <phase>generate-test-sources</phase> <configuration> <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/wsdl/myService.wsdl</wsdl> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.prehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>${build-helper-maven-plugin.version}</version> <executions> <execution> <id>add-test-sources</id> <phase>generate-test-sources</phase> <goals> <goal>add-test-source</goal> </goals> <configuration> <sources> <source>${project.build.directory}/generated/cxf</source> </sources> </configuration> </execution> </executions> </plugin> ... </plugins></build>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)