Search code examples
mavenintellij-idea

How to force Maven to update local repo


I compiled a JAR file in one project so it can be consumed in the 2nd one. I can see the JAR file in .m2 folder. But in the 2nd project it complains about "artifact not found".

I guess I have to force Maven to update indices/cache something but don't know what exactly. Any tip, thanks.

Update: Thanks for all good suggestions. Turns out that the Maven plugin (of IntelliJ) in the second project doesn't update its index. I used command line, it compiled ok.


Solution

  • If you are installing into local repository, there is no special index/cache update needed.

    Make sure that:

    1. You have installed the first artifact in your local repository properly. Simply copying the file to .m2 may not work as expected. Make sure you install it by mvn install

    2. The dependency in 2nd project is setup correctly. Check on any typo in groupId/artifactId/version, or unmatched artifact type/classifier.