【问题标题】:Skip maven plugin in parent project跳过父项目中的 maven 插件
【发布时间】:2021-10-31 23:31:55
【问题描述】:

我需要在父 pom 项目中跳过插件执行,但在子项目中执行它。这是怎么做到的?子项目使用 cxf-codegen-plugin 和路径 ${basedir}/src/main/resources/${wsdl-name}.wsdl 中的 wsdl,但父项目没有 wsdl。 p>

构建 => 父 pom.xml 中的插件

<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-sources/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/${wsdl-name}.wsdl</wsdl>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
                ...
        </plugins>
    </build>

【问题讨论】:

    标签: java maven pom.xml maven-plugin cxf-codegen-plugin


    【解决方案1】:

    您将上述插件配置移至&lt;pluginManagement&gt;。然后添加到父 POM 的 &lt;plugins&gt; 部分:

    <plugin>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-codegen-plugin</artifactId>
      <executions>
         <execution>
           <id>generate-sources</id>
           <inherited>false</inherited>
           <phase>none</phase>
         </execution>
      </executions>
    </plugin>
    

    【讨论】:

      猜你喜欢
      • 2010-12-02
      • 2017-01-02
      • 1970-01-01
      • 2021-03-11
      • 1970-01-01
      • 1970-01-01
      • 2013-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多