The migration of the build to Gradle and the usage of our bom plugin has resulted in a spring-boot.version
property in spring-boot-dependencies
being introduced unintentionally. We should remove it for the reasons described in the following issues:
- https://github.com/spring-projects/spring-boot/issues/5014
- https://github.com/spring-projects/spring-boot/issues/7048
- https://github.com/spring-projects/spring-boot/issues/8493
- https://github.com/spring-projects/spring-boot/issues/9823
Comment From: theHilikus
Is there any other property (or technique) that we should use to retrieve the current version of spring-boot? this issue broke our build since we were relying on this property to reconfigure some spring dependencies. Here's a snippet of our corporate-wide parent-pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/>
</parent>
...
</dependencyManagement>
...
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>${spring-boot.version}</version>
<optional>true</optional>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
<exclusions> <!-- override only to exclude tomcat. Children still need to declare this AND the actual container to use -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
The first dependency is declared by spring-boot-dependencies
as mandatory and with compile scope so we overwrite it here to optional and runtime (IMO this should be the default, but that's another discussion)
The second one is to avoid having each of our microservices to have to exclude tomcat explicitly since we are using jetty
With this technique all our projects can just declare a dependency to devtools and starter-web that are pre-configured while leaving the version number managed in the spring pom by you guys. Now we will have to duplicate the spring-boot version in the <parent>
section and in these dependencies and not forget to keep them in sync
Comment From: alan-czajkowski
@wilkinsona please undo the work of removing spring-boot.version
, as it is vitally important to keep it, as described here: https://github.com/spring-projects/spring-boot/issues/5014#issuecomment-703995304
Comment From: wilkinsona
Sorry for the inconvenience. Unfortunately, we won't be reinstating spring-boot.version
as it was introduced accidentally as part of migrating our build to Gradle. While we are aware there are some uses for the property, experience has taught us that its presence does more harm than good.
Comment From: theHilikus
But is there a proposed workaround? i.e. other official, more reliable, read-only way to know in the maven build what version of spring-boot a spring-boot-starter-parent
is pulling? if not, would this be an acceptable feature request worth creating?
Comment From: wilkinsona
@theHilikus It depends on what you are trying to do.
Where you want to exclude Tomcat in favour of Jetty, I'd provide your own starter that depends on spring-boot-starter-web
with spring-boot-starter-tomcat
excluded and spring-boot-starter-jetty
. Each of your web-based projects can then depend on this starter rather than having to depend on both spring-boot-starter-web
and spring-boot-starter-jetty
.
if not, would this be an acceptable feature request worth creating?
We're limited by Maven's capabilities here. We can suggest alternatives like the one above, but any feature request would have to be raised against Maven.