Eclipse中的Maven插件 - Settings.xml文件丢失

时间:2011-01-07 14:41:26

标签: eclipse maven m2eclipse maven-3

我为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)“Maven Integration for Eclipse”

2 个答案:

答案 0 :(得分:82)

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

在以下位置创建<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 Reference page

答案 1 :(得分:0)

在Mac上工作我按照Sean Patrick Floyd的回答将上面的settings.xml放在我的用户文件夹中 /Users/user/.m2 /

但这没有用。所以我打开了一个终端并在文件夹上做了 ls -la 。这显示

-rw-r--r--@

因此员工 everone 至少可以读取该文件。所以我想知道消息是否没有错,如果真正的原因是缺少写权限。我将文件设置为:

-rw-r--rw-@

这样做了。消息消失了。

相关问题