我需要在父pom项目中跳过插件执行,但在子项目中执行它。这是怎么做到的?子项目在路径 ${basedir}/src/main/resources/${wsdl-name}.wsdl 中使用 cxf-codegen-plugin 和 wsdl,但父项目没有 wsdl。
在父 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>
最佳答案
您将上述插件配置移至<pluginManagement>
。然后添加到 <plugins>
父 POM 的部分:
<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>
关于java - 跳过父项目中的 Maven 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69031119/