Currently we specify the location of local repository in the settings.xml. Is it possible to override this setting via command line or env variable, such that I can use an alternative location sometimes?
目前,我们在settings.xml中指定本地存储库的位置。是否可以通过命令行或env变量覆盖此设置,这样我有时可以使用其他位置?
2 个解决方案
#1
103
You would need to specify the maven.repo.local
parameter to do this.
您需要指定maven.repo.local参数来执行此操作。
mvn package -Dmaven.repo.local=/alternate/repo/location
Here is a related SO question.
这是一个相关的SO问题。
#2
13
Use the localRepository setting in your settings.xml file. Example:
使用settings.xml文件中的localRepository设置。例:
<settings>
<localRepository>/repo</localRepository>
...
</settings>
See here for more info.
有关详细信息,请参见此处
You can also set the repository via the command line using "-Dmaven.repo.local=" such as:
您还可以使用“-Dmaven.repo.local =”通过命令行设置存储库,例如:
mvn -U clean install -Dmaven.repo.local=C:\tmp
#1
103
You would need to specify the maven.repo.local
parameter to do this.
您需要指定maven.repo.local参数来执行此操作。
mvn package -Dmaven.repo.local=/alternate/repo/location
Here is a related SO question.
这是一个相关的SO问题。
#2
13
Use the localRepository setting in your settings.xml file. Example:
使用settings.xml文件中的localRepository设置。例:
<settings>
<localRepository>/repo</localRepository>
...
</settings>
See here for more info.
有关详细信息,请参见此处
You can also set the repository via the command line using "-Dmaven.repo.local=" such as:
您还可以使用“-Dmaven.repo.local =”通过命令行设置存储库,例如:
mvn -U clean install -Dmaven.repo.local=C:\tmp