Reputation: 137
I added a dependency using Maven to my Java project in Eclipse. I added one version of the dependency from repository, then I saw that version is not what I want, then added an higher version (that doesn't exist in repositories) manually using maven's commands. And finally I deleted the older version from pom.xml, and added the new version to there. I used following command to add newer version to repo:
mvn install:install-file -Dfile=PATH_OF_JAR -DgroupId=GROUP_ID -DartifactId=ARTIFACT_ID -Dversion=VERSION -Dpackaging=jar
Now the problem is that older version remains in "Maven Dependencies" group. And my code part using that dependency jar won't see the new version. I deleted manually the older version from Maven local repo, and also executed the "purge" command of Maven. Every time I update, the older version keeps coming back. How do I make my project just see the newer version and completely get rid of the older version?
The pom.xml entry is as following (which points the new version, the version I desire):
<dependency>
<groupId>org.eclipse.jface</groupId>
<artifactId>org.eclipse.jface</artifactId>
<version>3.7.0</version>
</dependency>
Upvotes: 0
Views: 2036
Reputation: 1020
Sounds like another dependency is bringing it in... Do a maven dependency tree to resolve your conflicts. See apache's guide here
mvn dependency:tree -Dverbose -Dincludes=YOUR_OLD_DEPENDENCY
You may also use tools to aid this such as your IDE
Intelli-j
Eclipse
Upvotes: 2
Reputation: 49351
If you use eclipse than have a look at the "Dependency Hierarchy" tab of the pom.xml viewer. Click at the org.eclipse.jface
artifact on the resolved dependencies tab and see where it comes from (maybe your version is overruled by a transitive dependency).
This answer is quite similar to @MMans answer (+1 for this) - just using other tools that might be easier to use than the command line (for some) ;-)
Upvotes: 1