是否可以不在父 pom 中指定 pluginManagement?
Is it possible to specify pluginManagement not in parent pom?
我正在尝试为多模块项目设置 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>
我可以使用项目清单中指定的依赖版本,但它不适用于插件。它给了我以下警告:
[WARNING] Some problems were encountered while building the effective model for <...>
[WARNING] 'build.plugins.plugin.version' for <org.some:plugin> is missing.
是否可以不在父 pom 中指定 pluginManagement 并导入它?
这目前是不可能的。有一个 open ticket in the Maven 项目可以添加此功能。
我正在尝试为多模块项目设置 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>
我可以使用项目清单中指定的依赖版本,但它不适用于插件。它给了我以下警告:
[WARNING] Some problems were encountered while building the effective model for <...>
[WARNING] 'build.plugins.plugin.version' for <org.some:plugin> is missing.
是否可以不在父 pom 中指定 pluginManagement 并导入它?
这目前是不可能的。有一个 open ticket in the Maven 项目可以添加此功能。