根据文档,我的Spring Boot应用程序pom中有以下内容:
<dependencyManagement>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
我需要使用
dependencyManagement
和<scope>import</scope>
,因为我需要使用标准的公司基础pom。然而,似乎无法排除
spring-boot-dependencies
的传递依赖项。在我的特定情况下,Spring Boot 1.2.1.RELEASE
引入了一个版本过于新的Jetty,与我的其他<dependencies>
不兼容。我尝试使用以下形式的<exclusion>
: <dependencyManagement>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
<!-- Doesn't work -->
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
使用Maven 3.2.1的通配符支持,但似乎没有生效。
除了显式地覆盖所有Jetty依赖项之外,是否有其他解决此问题的方法? Jetty库很多,这种方法会非常脆弱。 此外,似乎我还需要对Jetty的传递依赖项执行相同的操作。