简体   繁体   English

将父 pom 中使用的 Maven 插件的版本覆盖到主 pom 中的新版本

[英]Override version of Maven plugin used in parent pom to new version in main pom

Working on multi-module maven project.从事多模块 maven 项目。 Have maven-compiler-plugin used in parent pom as follows:在父 pom 中使用maven-compiler-plugin如下:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
      <source>${java.version}</source>
      <target>${java.version}</target>
    </configuration>
  </plugin>

Want to use <version>3.1</version> in the main project pom due to its incremental compile support.由于其增量编译支持,希望在主项目 pom 中使用<version>3.1</version> Do not have write access in parent pom.在父 pom 中没有写权限。 How can i just configure plugin in main project pom to use new version?如何在主项目 pom 中配置插件以使用新版本?

You can override the plugin in submodule您可以覆盖子模块中的插件

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
      <source>${java.version}</source>
      <target>${java.version}</target>
    </configuration>
  </plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM