Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  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!

like image 278
Octoberdan Avatar asked Apr 07 '10 22:04

Octoberdan


1 Answers

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
like image 174
Pascal Thivent Avatar answered Sep 28 '22 10:09

Pascal Thivent