SnakeYAML version not changing from 1.30 to 1.33 for my springboot project - spring-boot

These are the lines in my pom.xml:
<snakeyaml.version>1.33</snakeyaml.version>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
I added the new version dependency but the project still uses version 1.30. I believe some other things are controllling cthe snakeyaml version
I excluded all conflicting transitive dependencies and still the problem is not solved.
I am using springboot version: 2.7.6 for the project.

Related

MAVEN : Is There A Possibility to Personnalize the Tree of dependencies in Maven Project

In my Pom.XML, there is two dependency that get with them the: 'org.keyclaok:keycloak-core' dependency:
<dependency>
<groupId>ma.s2m.nxp</groupId>
<artifactId>nxp-keycloak-starter</artifactId>
<version>1.1.0</version>
</dependency>
which is a starter developped by the company that come with the 'org.keycloak:keyclaok-core' version 13.0.0,
<dependency>
<groupId>io.strimzi</groupId>
<artifactId>kafka-oauth-client</artifactId>
<version>${strimzi-oauth-callback.version}</version>
</dependency>
This dependency come with 'org.keycloak:keycloak-core' version 11.0.2,
and the strimzi-oauth-callback.version property is 0.6.1
When i run mvn dependency:tree, i get the 'org.keycloak:keycloak-core' with the version 11.0.2 (the dependency that come with 'kafka-oauth-client'), and i need it to come from 'nxp-keycloak-starter'

How to get Spring to use older version of Guava for specific Dependency, but newer version for "main" project

I have a dependency in my SpringBoot project:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cluster-zookeeper</artifactId>
<version>1.0.2.RELEASE</version>
</dependency>
Which requires Guava 16.01
However, my "main" project which I'm including cluster-zookeeper in requires Guava 28.2
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
When I run SpringBoot App, I get error:
The following method did not exist:
com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService;
The method's class, com.google.common.util.concurrent.MoreExecutors, is available from the following locations:
jar:file:/blah/.m2/repository/com/google/guava/guava/28.2-jre/guava-28.2-jre.jar!/com/google/common/util/concurrent/MoreExecutors.class
It was loaded from the following location:
file: /blah/.m2/repository/com/google/guava/guava/28.2-jre/guava-28.2-jre.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.common.util.concurrent.MoreExecutors
It seems like a version conflict issue where Spring tries to get cluster-zookeeper to use newer Guava version, when it require older one. How can I get this to work? I.e use 16.01 Guava for ONLY cluster-zookeeper while keeping 28.2 dependency for my main project?

Serialization errors due to jackson-databind version mismatch?

I am running into the following error
java.lang.NoSuchFieldError: WRITE_DURATIONS_AS_TIMESTAMPS
at com.fasterxml.jackson.datatype.joda.ser.DurationSerializer.<init>(DurationSerializer.java:28)
at com.fasterxml.jackson.datatype.joda.ser.DurationSerializer.<init>(DurationSerializer.java:25)
at com.fasterxml.jackson.datatype.joda.JodaModule.<init>(JodaModule.java:45)
I checked to see what versions of jackson-datatype-joda are available. It appears that maven has excluded all version mismatches.
Any other reason this might cause serialization errors?
The problem is that among the maven dependencies (mind that it could be a transitive one) you have incompatible versions of jackson-datatype-joda and jackson-databind. Incompatible in the sense that jackson-databind's SerializationFeature class is missing the WRITE_DURATIONS_AS_TIMESTAMPS field. To see what dependencies maven brings you can run the following command in the terminal (or you can use an IDE's maven plug to search and analyse the maven dependency tree):
mvn dependency:tree | grep databind
the outcome will most probably be something like:
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.1:compile
The version of course can vary but the important thing is that the WRITE_DURATIONS_AS_TIMESTAMPS field is only available since version 2.5
You can exclude a transitive dependency like this:
<dependency>
<groupId>group.id</groupId>
<artifactId>artifact-id</artifactId>
<version>${artifact.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
If it's not a transitive dependency you need to update version of jackson-databind.
I got it resolved by using following dependency as this dependency has overridden any other version used:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.5.3</version>
</dependency>
I had same error. I had included all jackson*2.7.0 libraries under WEB-INF/lib/ and i was still getting that error. I am using wildfly 8.2 and it had jackson 2.4.1 libraries under modules and somehow it was loading 2.4.1 jars from that location. So I had to manually upgrade them to 2.7.0 which fixed the issue. I was under impression that if I did not mention it to load jackson jars in deployment configuration file, it would not load wildfly jars. I guess I was wrong.

Drools 6 sisu-guava conflicts with guava

We have recently upgraded from Drools 5 to Drools 6 and have run into disturbing conflict issues.
We have kie-ci imported into out project. kie-ci brings in sisu-guava. sisu-guava changes the accessibility of some of the classes from google's guava. Unfortunately, it uses the same package name as google's guava.
Since we're working with google's guava in our project, we are running into conflicts of classes.
An attempt to remove sisu-guava from the project (using a maven exclusion) results in accessibility exceptions, as the kie-ci code attempt to access classes which are public in sisu-guava but are private in google's guava.
Any idea how to get round this.
This may not be correct solution for all situation, but I was able to resolve this issue by excluding the susi-guava jar in my pom:
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-kie-services</artifactId>
<version>${jbpm.version}</version>
<exclusions>
<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guava</artifactId>
</exclusion>
</exclusions>
</dependency>
I seem to have the same problem using drools 6.2. Drools is dependent on guava 10.0.1, where as my project had a dependency on guava 16 and maven was picking the version 16 (correctly).
On inspecting the dependency tree, I find that the drools dependency on guava is dictated by "org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M5:runtime".
There is a newer version of org.eclipse.sisu.plexus, so I added the following to my project's pom to pick up the latest version, which is:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>0.3.1</version>
</dependency>
</dependencies>
</dependencyManagement>
Now, there does not seem to be a dependency on guava, for drools and the problem is solved and my project can use version 16 of guava.

How to include eclipselink dependency in maven project

I have following dependency in pom.xml
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
</dependency>
and the library is there on repo : http://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/2.5.2/
but eclipse is unable to download the library. Eclipselink version 2.5.0 is getting downloaded successfully, what is the problem with 2.5.2 ?
2.5.2 is fairly new. Perhaps it hasn't made it around to all of the mirrors, or something went wrong when it was published to maven central? Does 2.5.1 work for you?

Resources