views:

105

answers:

2

Hello,

I am looking for a way to not have a plugin execute on install. More specifically, my scenario is as follows:

  1. I am using org.apache.cxf:cxf-codegen-plugin to generate source code.
  2. Every time I clean+install the source is generated
  3. I only want generation of source code to happen when I explicitly request it.

Any and all help would be greatly appreciated!

A: 

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

JavadocMD
+1  A: 

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
Pascal Thivent
This is exactly what I'm looking for! Thanks :-)
Octoberdan