AFAIK maven does not have an installer for Windows, you simply unzip it wherever you like, as explained here.
However in many places there are references to a .m2
folder under the user folder (in Win7 I would guess it to be by default at C:\Users\.m2
. Alas I do not have that folder. Is there some command to create this folder? Am I missing something basic?
This question is related to
windows
maven
installation
Use mvn -X
or mvn --debug
to find out from which different locations Maven reads settings.xml. This switch activates debug logging. Just check the first lines of mvn --debug | findstr /i /c:using /c:reading
.
Right, Maven uses the Java system property user.home
as location for the .m2 folder.
But user.home
does not always resolve to %USERPROFILE%\.m2
. If you have moved the location of your Desktop folder to another place, user.home
might resolve to the parent directory of this new Desktop folder. This happens when using Windows Vista or a more recent Windows together with Java 7 or any older Java version.
The blog post Java’s “user.home” is Wrong on Windows describes it very well and gives links to the official bug reports. The bug is marked as resolved in Java 8. The comment of the blog's visitor Lars proposes a nice workaround.
If I'm right, it's just because you are missing the cd
command. Try c:\Users\Jonathan\cd .m2/
.
Check the configurations in {M2_HOME}\conf\setting.xml as mentioned in the following link.
http://www.mkyong.com/maven/where-is-maven-local-repository/
Hope this helps.
Is there some command to create this folder?
If smb face this issue again, you should know the most simple way to create .m2
folder.
If you unzipped maven and set up maven path variable - just try mvn clean
command from anywhere you like!
Dont be afraid of error messages when running - it works and creates needed directory.
If the default .m2 is unable to find, maybe someone changed the default path. Issue the following command to find out where is the Maven local repository,
mvn help:evaluate -Dexpression=settings.localRepository
The above command will scan for projects and run some tasks. Final outcome will be like below
As you can see in the picture the maven local repository is C:\Users\INOVA\.m2\repository
When you first install maven, .m2 folder will not be present in C:\Users\ {user} path. To generate the folder you have to run any maven command e.g. mvn clean, mvn install etc. so that it searches for settings.xml in .m2 folder and when not found creates one.
So long story cur short, open cmd -> mvn install
It will show could not find any projects(Don't worry maven is working fine :P) now check your user folder.
P.S. If still not able to view .m2 folder try unhiding hidden items.
Do you have the file system display config set up to show hidden files and folders? If I remember correctly, by default it's hidden. Should be under c:\users\username\.m2.
Source: Stackoverflow.com