默认情况下跳过maven2插件

Oct*_*dan 6 maven-2 cxf wsdl2java jax-ws

我正在寻找一种不在安装时执行插件的方法.更具体地说,我的方案如下:

  1. 我正在使用org.apache.cxf:cxf-codegen-plugin来生成源代码.
  2. 每次我清理+安装源都会生成
  3. 我只想在明确请求时生成源代码.

任何和所有的帮助将不胜感激!

Pas*_*ent 11

我只想在明确请求时生成源代码.

最好的选择是在配置文件中添加插件声明并显式激活此配置文件:

<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>
Run Code Online (Sandbox Code Playgroud)

当您希望代码生成发生时,请运行以下命令:

mvn clean install -Pcodegen
Run Code Online (Sandbox Code Playgroud)