关于Eclipse中的Maven插件: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,都必须自己创建。

在以下位置创建它/.m2/settings.xml
例如 在Windows上C:\Users\YourUserName\.m2\settings.xml在Linux上/home/YourUserName/.m2/settings.xml

您可以使用以下空骨架:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<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/>
 
</settings>

如果使用Eclipse对其进行编辑,则它会在编辑时自动完成。

这是Maven settings.xml参考页面


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

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

1
-rw-r--r--@

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

1
-rw-r--rw-@

做到了。 消息消失了。