I really don’t get it, I have a multimodule project (snapshots) and I’m using Nexus repo manager. If I make changes to projectB and $mvn install it, then projectA still uses the old dependency when being built.
No matter if I do $mvn -o compile or $mvn -U compile, it still has the old dependency on classpath.
If I deploy projectB $mvn deploy, projectA still gets the old dependency on classpath
unless I go $mvn -U compile, then fresh snapshot projectB dependency is served on classpath of projectA when being built. This works as expected.
BUT
$mvn install simply doesn’t allow me to use the installed artifact version from outside, no matter what. I always have to deploy it and run $mvn -U compile for others to get the fresh dependency.
Could please anybody explain to me, why this happens ? Clearly maven install and update should work, but it requires deploy. What the hell ?
mvn installinstalls the built jars to the local repo at ~/m2/repository/. When it comes to snapshots,mvn installreplaces the old snapshot with the new one.It seems there’s an issue with your local repo. So, I suggest deleting the current snapshots from the local repo, and try again. In the worst case, delete the entire ~/.m2 repo and try again.
Right now you are doing it the hard way by uploading your artifacts to the remote and repo (via
mvn deploy), and downloading again withmvn -U compile.Based on the comments – it seems to be a bug in the maven-install-plugin. Newest version is maven-install-plugin-2.3.1. Set the plugin explicitly in your pom.