Spring boot starter parent version update - java

my current spring boot project has spring boot starter parent dependency pom file with version as 1.5.release. Is it possible to upgrade to version 2.0. If so, how can we achieve this?

Just write <version>2.0.0</version> below the artifactId tag for the dependency.

Related

How to find out which dependency version I should use?

I'm implementing a new feature in my project, in this case replacing the resttemplate with the webclient. I put this dependency in my pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>???</version>
</dependency>
I used the mvn dependecy:tree command to find out which version of spring-web was current and I verified that it was 3.2.8-RELEASE. How to find out which spring-boot-starter-webflux version I should use in my project's maven so I don't have dependency issues like this: java.lang.NoClassDefFoundError: org/springframework/http/client/reactive/ClientHttpConnector
In other words, how do I find out which version of spring-boot-starter-webflux is compatible with the version of spring-web I'm using?
if I omit the version, when building, I get the error dependencies.dependency.versin is missing.
Spring Boot includes dependency management tools to help solve this problem. If you're using any Spring Boot dependencies, the versions of all your Spring and Spring Boot dependencies should ideally be managed by Spring Boot.
A simple way to do this is to apply the Spring Boot BOM (Bill of Materials) in your Maven dependency management.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Replace the version here with the version of Spring Boot that you want to use. You can then omit the version number from any other Spring or Spring Boot dependencies.
The Spring Boot team maintains the bill of materials so that it provides compatible versioning for all the Spring and Spring Boot components as well as other libraries that the Spring framework depends on.
You can find more information in the docs here: https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.build-systems.dependency-management
If you would like to refer to Spring's version compatibility table manually, it's published in the Spring Boot docs. For example, you can find the compatible dependency versions for the current version of Spring Boot here: https://docs.spring.io/spring-boot/docs/current/reference/html/dependency-versions.html
A good place to start if you're trying to identify the compatible Spring Boot version for an existing dependency is to compare their release dates. Look for a Spring Boot version that was released around the same time as your dependency. Then you can look at the compatibility table for that Spring Boot version. By using that method, I couldn't find a version of Spring Boot that's compatible with spring-web 3.2.8. That version of spring-web is over 8 years old and predates the first release of Spring Boot. You should upgrade it, if you can.

Maven dependency with older spring boot version

Is it somehow possible to use Maven dependency with older Spring Boot version? The project is using version 2.x and the custom dependency uses 1.5.x.
Could not found any documentation on the topic.
I'm asking because of getting a NoClassDefFoundError while introspecting class inside the custom jar file.
No. Spring Boot 2.X is a major version which is not backwards compatible with Spring Boot 1.5.X. Same goes for major Spring Framework versions, you can't mix Spring Framework 5.X and 4.X.
Maven only manages project dependencies. It has nothing to do with your problem.
Basically there can only be one version of any given combination of groupId and artifactId in any maven project. So with plain vanilla maven, the answer is 'No'. But there is the maven-shade-plugin that can be used to change the group- and artifact ids of any dependency.

Exclude Jhipster and upgrade Spring Boot from 1.4.0 to 2.0.3

I am using spring boot 1.4.0 along with jhipster 3.6.1 in my project. I want to upgrade spring boot from 1.4.0 to 2.0.3 but I found some release notes of jhipster according to which it won't support Spring boot 2.0.3.
Can anyone help me out by letting me know if there is any easy and quick way to exclude jhipster from my project.
JHipster 3 won't be updated for Spring Boot 2, only JHipster 5 supports it.
So either you upgrade your project to JHipster 5 using jhipster upgrade command or you remove all dependencies from JHipster and you manually upgrade your project.
These dependencies can be of 3 types: BOM for maven dependencies, server library and client library (not required for your use case). For BOM and server library, the idea is to retrieve the source of the version used by your app and to integrate it into your own git repo so that you can modify it.

Upgrading Spring boot 2.0.1 to Spring 2.0.4

Is there a way to Upgrade a existing spring boot 2.0.1 project to a spring 2.0.4 project ? Such as overriding the maven dependencies ?

Which maven dependency can be used for getting updated Jackson dependency fetched as transitive dependency?

Spring 5.x versions requires jackson dependencies and they needs to me added in pom.xml explicitly.And overtime if there is version upgrade then the dependency needs to be updated.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.4</version>
</dependency>
Is there any jar or dependency that can be used in pom.xml (preferably spring jar) which automatically fetches the latest jackson dependency as its transitive dependency . The requirement is to avoid jackson-core jar entry in pom.xml.
spring boot dependency cannot be used as it is very heavy.
Any other solution that can execute the spring 5.x version without mentioning jackon jar dependency in pom would also help.
Not sure it's a good idea to manage dependencies in such way, but spring-cloud-config loads jackson-core for example
Not sure if it would help, but there is jackson-bom:
http://mvnrepository.com/artifact/com.fasterxml.jackson/jackson-bom
which can be imported (instead of used as parent pom) and gives consistent versions for all standard jackson components, via Maven's dependencyManagement section. That way you only need to add one dependency with explicit version.

Categories