Search code examples
javamavenjardependency-management

Pom.xml with local jar and concurrent dependency


Here is the situation :

I want to use a locally installed jar in a springboot project. I included the dependency to this artifact in my pom.xml :

    <dependency>
        <groupId>org.mycie.myjar</groupId>
        <artifactId>myjar</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

This jar uses the artifact snakeyaml with version 1.16

But in my main project, Springboot uses snakeyaml version 1.23

The concurrency seems to cause some issues when running the application. Do you have any idea on the good practices to tackle this issue?


Solution

  • Maven will only let one of the jars into the resulting application. You can find out by calling mvn dependency:list which jar Maven chose.

    The resulting problem cannot be really solved by Maven. Instead, you need to figure out which version of snakeyaml works for all scenarios. Since one of the jars belongs to you, it is probably best to just update the dependency of myjar to avoid this problem.