我希望在安装时不执行插件。更具体地说,我的情况如下:
- 我正在使用 org.apache.cxf:cxf-codegen-plugin 生成源代码。
- 每次清理+安装源代码都会生成
- 我只想在显式请求时生成源代码。
非常感谢您的任何帮助!
我只希望在显式请求时才生成源代码。
最好的选择是将插件声明添加到配置文件中,并显式激活此配置文件:
<project>
...
<profiles>
<profile>
<id>codegen</id>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-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>
</plugins>
</build>
</profile>
</profiles>
</project>
当您需要进行代码生成时,请运行以下命令:
mvn clean install -Pcodegen
我相信您想在POM中的cxf插件元素中添加一个executions元素。您应该能够将生成目标绑定到您喜欢的阶段。请参见:http://maven.apache.org/pom.html#Plugins