In my maven pom.xml I have the following dependency:
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>Chart.js</artifactId>
<version>2.0.2</version>
</dependency>
When I build it, maven loads Version 1.1.1 instead of 2.0.2. I can't explain why this could happen. mvn dependency:tree gives me the following output:
[INFO] my.group:mypackage:war:0.0.1-SNAPSHOT
[INFO] ...
[INFO] +- org.webjars.bower:Chart.js:jar:1.1.1:compile
[INFO] +- org.webjars.bower:angular-chart.js:jar:0.10.2:compile
[INFO] ...
So, Chart.js is a direct dependency of my project and no other dependency depends on Chart.js and forces loading of version 1.1.1. Even when I look at the effective pom in IntelliJ, there is no dependency for version 1.1.1, only my dependency for 2.0.2.
Any idea why maven loads the wrong version?
Your problem is that angular-chart.js:jar:0.10.2 has a dependency to chart.js 1.1.1. You have a conflict here.
Look at this link to see all dependencies: https://mvnrepository.com/artifact/org.webjars.bower/angular-chart.js/0.10.2
You need to add exclusion tags when you add the angular-chart.js dependency:
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>angular-chart.js</artifactId>
<version>0.10.2</version>
<exclusions>
<exclusion>
<groupId>org.webjars.bower</groupId>
<artifactId>Chart.js</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>Chart.js</artifactId>
<version>2.0.2</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With