开发者

How to change maven repository folder in windows?

In windows, m开发者_StackOverflow社区aven downloads everything in the C:\Documents And Settings\MyUser\.m2 folder (or C:\Users\MyUser\.m2). There exists some way to change the folder that it uses? Specially I want to set it to download anywhere BUT in the Documents And Settings/Users folder.


Look at your settings.xml in ${maven.home}/conf or, preferrably, ${user.home}/.m2/settings.xml (see this for details about the settings.xml). You can add (or uncomment) the following section:

  <!-- localRepository
  | The path to the local repository maven will use to store artifacts.
  |
  | Default: ~/.m2/repository
  -->
 <localRepository>/path/to/local/repo</localRepository>
 

as suggested by the commented out section already there by default. There, you should be able to change the path to achieve what you want.


For Eclipse IDE

If you are using your local maven as the Maven Installation in M2 plugin in Eclispe, editing the settings.xml wasn't enough for me. The plugin was still using the default {user.home}/.m2 as the repository location.

I had to go to : Windows > Preferences > Maven > User Settings and point to my local maven's settings.xml file in the Global Settings and/or User Settings input fields. Clicking apply will then start storing artifacts in the correct destination.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜