我正在尝试为多模块项目设置 Maven 插件管理。我想使用pluginManagement
没有继承的部分(指定不在父 pom 中的插件版本)。我的项目结构看起来像这样
base_project
-- pom.xml
-- project-bom
-- pom.xml
-- project-a
-- pom.xml
Run Code Online (Sandbox Code Playgroud)
在根 pom.xml 中我只有两个模块:
<modules>
<module>project-bom</module>
<module>project-a</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
在 project-bom pom.xml 中,我指定了包含dependencyManagement
我pluginManagement
想要使用的依赖项和插件版本的部分:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.some</groupId>
<artifactId>dependency</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.some</groupId>
<artifactId>plugin</artifactId>
<version>1.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
在project-a pom.xml中,我导入project-bom pom并使用依赖项和插件:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.project</groupId>
<artifactId>project-bom</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.some</groupId>
<artifactId>dependency</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.some</groupId>
<artifactId>plugin</artifactId>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我可以使用项目 bom 中指定的依赖项版本,但它不适用于插件。它给了我以下警告:
[WARNING] Some problems were encountered while building the effective model for <...>
[WARNING] 'build.plugins.plugin.version' for <org.some:plugin> is missing.
Run Code Online (Sandbox Code Playgroud)
是否可以指定不在父pom中的pluginManagement并导入它?
归档时间: |
|
查看次数: |
2050 次 |
最近记录: |