0

What is priority of conflicting resources from maven dependncies? If any? Say I have following pom.xml :

   <depndency>
     <artifactId>a</artifactId>
   </dependency>
   <depndency>
     <artifactId>b</artifactId>
   </dependency>

both dependencies (a,b) have following structure:

pom.xml
src/main/resources/META-INF/logo.png

By experiment I see that logo.png in resulting JAR comes from dependency a. Thus is is must-be? Or just by random?

Bogdan
  • 702
  • 3
  • 6
  • 22
  • 1
    The order in the classpath is the ordering criteria...The other question is why a file is in `META-INF` directory? Usually resources should be in `src/main/resources`...(In the source not in the final jar) – khmarbaise Dec 06 '21 at 07:42
  • I guess you can try `mvn dependency:tree` to check how maven is resolving the dependencies. In case both the jars are on classpath, then really it is really going to be dependent on classloader as to which version takes priority. You can refer following link for the same : https://stackoverflow.com/questions/46537199/classloader-how-to-load-different-version-of-jar – Sukhmeet Sethi Dec 06 '21 at 07:56

0 Answers0