Eclipse 中的 Maven 插件 - Settings.xml 文件丢失
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4626609/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven plugin in Eclipse - Settings.xml file is missing
提问by emeralddove
I installed the maven plugin for eclipse. Then tried updating the index and got the following error:
我为eclipse安装了maven插件。然后尝试更新索引并收到以下错误:
Unable to update index for central|http://repo1.maven.org/maven2
无法更新中央索引|http://repo1.maven.org/maven2
While trying to edit the proxy settings through windows-preferences-maven-user settings, I realise there is no such file. I don't have separate maven installation and only the plugin. Please someone could help resolving the problem? Thank you very much.
在尝试通过 windows-preferences-maven-user 设置编辑代理设置时,我意识到没有这样的文件。我没有单独的 maven 安装,只有插件。请问有人可以帮助解决问题吗?非常感谢。
Cheers A
干杯
Config: Helios Service Release 1 org.maven.ide.eclipse.feature (0.12.0.20101115-1102) "Maven Integration for Eclipse"
配置:Helios Service Release 1 org.maven.ide.eclipse.feature (0.12.0.20101115-1102)“Eclipse 的 Maven 集成”
回答by Sean Patrick Floyd
The settings file is never created automatically, you must create it yourself, whether you use embedded or "real" maven.
设置文件永远不会自动创建,您必须自己创建,无论您使用嵌入式还是“真正的”maven。
Create it at the following location <your home folder>/.m2/settings.xml
e.g. C:\Users\YourUserName\.m2\settings.xml
on Windows or /home/YourUserName/.m2/settings.xml
on Linux
在以下位置创建它,<your home folder>/.m2/settings.xml
例如C:\Users\YourUserName\.m2\settings.xml
在 Windows 或/home/YourUserName/.m2/settings.xml
Linux 上
Here's an empty skeleton you can use:
这是您可以使用的空骨架:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
If you use Eclipse to edit it, it will give you auto-completion when editing it.
如果您使用 Eclipse 对其进行编辑,它会在编辑时为您提供自动完成功能。
And here's the Maven settings.xml Reference page
回答by LuCio
Working on Mac I followed the answer of Sean Patrick Floyd placing a settings.xml like above in my user folder /Users/user/.m2/
在 Mac 上工作我遵循 Sean Patrick Floyd 的回答,在我的用户文件夹/Users/user/.m2/ 中放置了一个像上面一样的settings.xml
But this did not help. So I opened a Terminal and did a ls -laon the folder. This was showing
但这没有帮助。所以我打开了一个终端并在文件夹上做了一个ls -la。这是显示
-rw-r--r--@
thus staffand everonecan at least read the file. So I wondered if the message isn't wrong and if the real cause is the lack of write permissions. I set the file to:
因此,工作人员和EVERONE至少可以读取该文件。所以我想知道消息是否没有错,真正的原因是否是缺乏写权限。我将文件设置为:
-rw-r--rw-@
This did it. The message disappeared.
这做到了。消息消失了。