Maven missing default settings.xml
Answered
I do not like keeping my IDE data in c:\users\<myUser>\.m2 so I moved it to the D: drive and changed the appropriate settings to ensure that the location is found.
But on my first "maven install" I got the error indicating that the D: settings.xml file does not exist. No problem I figured, I'll just copy it from the *\.m2 location... but there is none there to copy.
Where do I grab (or how do I create) a standard IntelliJ settings.xml file? (I have the Ultimate version in case that is relevant to the file contents)
Please sign in to leave a comment.
By default there is no settings.xml file for Maven. If needed, you create one manually per https://maven.apache.org/settings.html.
It refuses to do a "maven install" without the settings.xml.
I'll create one. I assume that I only need to put in it the minimum necessary (maybe even just the open and close tags), right? Or is there a minimum set of entries required?
Does it fail only in IntelliJ IDEA or in the command line Maven as well?
Did you override it in Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | User settings file? Does it help if you disable the Override checkbox?
This file should not be needed for Maven builds unless you specify it as an option explicitly.
I don't have command line Maven installed. I rely on Eclipse and IntelliJ IDEA's included versions of Maven.
Yes, I did override the location in the BuildTools configuration. That is why I went to try and copy it from .m2 (and failed to find the file even though that is the "default" location) to the new location on my D: drive.
I can confirm that the file is not needed for builds. But it *does* appear to be required to do a "maven install" to place the resulting JAR into the local repository... which of course is essential so that other projects that depend on it can find it. When I try to do a maven install without the file it throws an error complaining that it is missing. Probably because settings.xml is what tell Maven the location of the local repository.
Without settings.xml it should install into the default location. Make sure you do not override the settings file.
Install works fine and the artifact appears under E:\m2:
And there is no "C:\Users\serge\.m2\settings.xml" file on my system.
Thanks, that worked for the project.
The install step now runs and the project shows in the local repository.
Also, I ended up consolidating the eclipse projects from the workspace into a single IntelliJ IDEA project (with each eclipse project presented as an IntelliJ module) and it seems to build fine.
1. File | New Projects Setup | Settings for New Projects.
2. Repositories are specified either in pom.xml or in settings.xml, refer to Maven documentation for details. IntelliJ IDEA just shows what Maven provides.
Perfect!!! I had not seen that option in the File folder.