从父 pom 的插件执行中删除一个目标

最近我们将 maven 版本更改为 3.5.4

Maven Super POM 中的 maven-source-plugin jar 目标已更改为 jar-no-fork

我们有公司主 pom:

<plugin>

    <groupId>org.apache.maven.plugins</groupId>

    <artifactId>maven-source-plugin</artifactId>

    <version>3.0.1</version>

    <executions>

        <execution>

            <id>attach-sources</id>

            <goals>

                <goal>jar</goal>

            </goals>

        </execution>

    </executions>

</plugin>

哪一项是我无法改变的。与我得到的有效pom中的maven super pom一起


<plugin>

  <artifactId>maven-source-plugin</artifactId>

  <version>3.0.1</version>

  <executions>

    <execution>

      <id>attach-sources</id>

      <goals>

        <goal>jar-no-fork</goal>

        <goal>jar</goal>

      </goals>

    </execution>

  </executions>

  <inherited>true</inherited>

</plugin>

在发布期间,源会生成两次(一个文件覆盖第二个文件),但在部署到 Artifactory 时,我收到错误,因为没有覆盖工件的权限。


我可以配置一些如何我的 pom 来禁用插件的一个目标吗?


三国纷争
浏览 126回答 1
1回答

慕标5832272

您需要从父 pom 中删除执行(删除默认阶段就足够了)并添加具有新目标的新执行:<plugin>&nbsp; <groupId>org.apache.maven.plugins</groupId>&nbsp; <artifactId>maven-source-plugin</artifactId>&nbsp; <version>3.0.1</version>&nbsp; <executions>&nbsp; &nbsp; <execution>&nbsp; &nbsp; &nbsp; <id>attach-sources</id>&nbsp; &nbsp; &nbsp; <phase/>&nbsp; &nbsp; </execution>&nbsp; &nbsp; <execution>&nbsp; &nbsp; &nbsp; <id>custom-attach-sources</id>&nbsp; &nbsp; &nbsp; <goals>&nbsp; &nbsp; &nbsp; &nbsp; <goal>jar-no-fork</goal>&nbsp; &nbsp; &nbsp; </goals>&nbsp; &nbsp; </execution>&nbsp; </executions>&nbsp; <inherited>true</inherited></plugin>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java