Use alternate local maven repository

Answered

When I imported a maven project I had been working on in JBDS, it couldn't find a lot of the artifacts that it was looking for in the local repository. I have my $MAVEN_HOME set to a directory on my D: drive and the global settings.xml file there specifies that repo as the one to use. IntelliJ was using the .m2 directory in my home directory for the repository (this is the default for maven on windows.) So I deleted that direcdtory and it still wants to use that.

Where do I tell IntelliJ to use a different path for the local maven repository?

Thanks,
SE

1
5 comments

File > Settings > Project Settings > Maven

For the "Local Repository", check the override box and set the desired location. Alternatively, you can override the "User settings file" to use your alternative settings.xnl file that specifies the alternate repo.

To make this change as part of the template for all new projects so future projects have it in place, do the same thing under File > Other Settings > Template Settings > TemplateProject Settings > Maven

3

Thanks. I have no idea how I missed that.

1

I have configured the settings.xml, but IntelliJ ignores the local repository path in that file. I still had to explicitely check the "override" checkbox in the GUI and select the alternative path there.

0

Actually, just now my IntelliJ lost the override settings completely. The "override" checkboxes are not checked anymore. I have no idea what IntelliJ is doing...

0

What do you mean? Note that this option is set per project:

Please provide IDE logs after reproducing (Help | Collect Logs and Diagnostic Data action) if problem is reproducible.

0

Please sign in to leave a comment.