无法在/var/root/.m2/repository中创建本地存储库 [英] Could not create local repository at /var/root/.m2/repository
问题描述
我的本地Maven存储库位于/Users/power/.m2/repository
.
My local maven repo is here /Users/power/.m2/repository
.
但是我遇到了这个错误
[java] [ERROR] Could not create local repository at /var/root/.m2/repository -> [Help 1]
似乎Maven认为它应该使用root用户存储库.我该如何解决?我不需要使用root权限运行我的maven任务.
Seems Maven thinks that it should use a root user repo. How can I fix it? I don't need to run my maven tasks using root permissions.
推荐答案
默认的Maven存储库是
The default maven repository is
${user.home}/.m2/repository/
,但是您可以使用settings.xml(${user.home}/.m2/settings.xml
)将其更改为您有权访问的文件夹.或$ {MAVEN_HOME}中的conf/settings.xml并更改:
but you can use settings.xml ( ${user.home}/.m2/settings.xml
) to change it to a folder that you have permissions on. Or conf/settings.xml in the ${MAVEN_HOME} and change:
<settings>
...
<localRepository>/path/to/local/repo/</localRepository>
...
</settings>
理想情况下,您应该以自己的身份运行maven,而不是root用户,以确保您具有权限或先执行"ksu",然后再使用命令行.
Ideally, you should run maven as yourself and not root to make sure you have permissions or doing 'ksu' first and then use command line.
这篇关于无法在/var/root/.m2/repository中创建本地存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!