Skip maven2 plugin by default
I am looking for a way to not have a plugin execute on install. More specifically, my scenario is as follows:
- I am using org.apache.c开发者_开发百科xf:cxf-codegen-plugin to generate source code.
- Every time I clean+install the source is generated
- I only want generation of source code to happen when I explicitly request it.
Any and all help would be greatly appreciated!
I only want generation of source code to happen when I explicitly request it.
The best option would be to add the plugin declaration in a profile and to explicitly activate this profile:
<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>
And run the following when you want the code generation to happen:
mvn clean install -Pcodegen
I believe you want to add an executions element to cxf's plugin element in your POM. You should be able to bind the generation goal to the phase you'd prefer. See: http://maven.apache.org/pom.html#Plugins
精彩评论