maven - 是否可以在父 pom 中指定 pluginManagement?
问题描述
我正在尝试为多模块项目设置 Maven 插件管理。我想使用pluginManagement
没有继承的部分(指定不在父 pom 中的插件版本)。我的项目结构看起来像这样
base_project
-- pom.xml
-- project-bom
-- pom.xml
-- project-a
-- pom.xml
在根 pom.xml 我只有两个模块:
<modules>
<module>project-bom</module>
<module>project-a</module>
</modules>
在 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>
在 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>
我可以使用 project-bom 中指定的依赖版本,但它不适用于插件。它给了我以下警告:
[WARNING] Some problems were encountered while building the effective model for <...>
[WARNING] 'build.plugins.plugin.version' for <org.some:plugin> is missing.
是否可以在父 pom 中指定 pluginManagement 并导入它?
解决方案
目前这是不可能的。在 Maven项目中有一个open ticket可以添加此功能。
推荐阅读
- java - 使用 servlet 将 HTML 页面重定向到另一个页面
- c# - 我有以下字符串“12-5”,我正在尝试使用.NET 中的 TryParse 解析它。它返回真,如何为给定的字符串实现假?
- time-series - 按列从 TimeArray 中提取另一个
- git - 可以设置 ssh 密钥以在 go 程序中为 git 命令工作吗?
- python - 如何根据给定条件为熊猫数据框中的单元格着色?
- node.js - 将 Vs Post 放在 Node Js 中
- java - 使用 Artemis、JBoss EAP 7.1 和 last-value-queue
- google-apis-explorer - Google Directory API user list request failing with 400 Invalid Input
- gitahead - How can I disable auto refresh in GitAhead
- javascript - How to display all events of the year?