繁体   English   中英

Eclipse中的Maven插件-缺少Settings.xml文件

[英]Maven plugin in Eclipse - Settings.xml file is missing

我为Eclipse安装了Maven插件。 然后尝试更新索引并得到以下错误:

无法更新中央索引| http://repo1.maven.org/maven2

在尝试通过Windows-preferences-maven-user设置编辑代理设置时,我意识到没有这样的文件。 我没有单独的Maven安装,只有插件。 请有人可以帮助解决问题吗? 非常感谢你。

干杯

配置:Helios Service Release 1 org.maven.ide.eclipse.feature(0.12.0.20101115-1102)“针对Eclipse的Maven集成”

设置文件永远不会自动创建,无论您使用嵌入式还是“真实” Maven,都必须自己创建。

在以下位置<your home folder>/.m2/settings.xml C:\\Users\\YourUserName\\.m2\\settings.xml <your home folder>/.m2/settings.xml创建它,例如在Windows上为C:\\Users\\YourUserName\\.m2\\settings.xml或在Linux上是/home/YourUserName/.m2/settings.xml

这是您可以使用的空骨架:

<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>

如果使用Eclipse编辑它,它将在编辑时自动完成。

这是Maven settings.xml参考页面

在Mac上工作时,我遵循了Sean Patrick Floyd的回答,将如上所述的settings.xml放在我的用户文件夹/Users/user/.m2/中。

但这并没有帮助。 因此,我打开了一个终端,并在文件夹上执行了ls -la 这表明

-rw-r--r--@

这样员工所有人都至少可以读取该文件。 所以我想知道消息是否正确,真正的原因是否是缺少写入权限。 我将文件设置为:

-rw-r--rw-@

做到了。 消息消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM