我理解<dependencyManagement>配置会影响到<dependencies>和那里的传递依赖关系。但也会影响<pluginManagement>或<plugins>下的插件。
我有一个没有发生的情况,但我只想确认一下,我的配置中是否存在一般性行为或某些问题。
假设我需要使用the-plugin,即作为依赖项dep-a:1.0。但是我需要让the-plugin使用dep-a:1.1代替。
以下pom是否正确配置以达到此目的?
<dependencyManagement>
<dependencies>
<dependency>
<groupId>group-a</groupId>
<artifactId>dep-a</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>group-plugin</groupId>
<artifactId>the-plugin</artifactId>
<version>1.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>我测试了上面的pom,但没有工作,我必须做下面的工作,使它的工作,我需要。这是正确的配置吗?
<dependencyManagement>
<dependencies>
<dependency>
<groupId>group-a</groupId>
<artifactId>dep-a</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>group-plugin</groupId>
<artifactId>the-plugin</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>group-a</groupId>
<artifactId>dep-a</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>发布于 2022-07-18 10:26:35
dependencyManagement用于项目的依赖关系,而不是用于插件的依赖关系。这是两件不同的事情。
换句话说,给定的dependencyManagement不能影响插件的依赖性。
如果一个插件需要一个不同的版本,有以下选项:
https://stackoverflow.com/questions/73008202
复制相似问题