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

发布于 2024-10-11 04:59:10 字数 335 浏览 7 评论 0原文

我安装了eclipse的maven插件。然后尝试更新索引并收到以下错误:

Unable to update index forcentral|http://repo1.maven.org/maven2

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

干杯 配置

:Helios 服务版本 1 org.maven.ide.eclipse.feature (0.12.0.20101115-1102)“Eclipse 的 Maven 集成”

I installed the maven plugin for eclipse. Then tried updating the index and got the following error:

Unable to update index for central|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.

Cheers
A

Config: Helios Service Release 1
org.maven.ide.eclipse.feature (0.12.0.20101115-1102) "Maven Integration for Eclipse"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

随梦而飞# 2024-10-18 04:59:10

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

在以下位置创建它<您的主文件夹>/.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 参考页面

The settings file is never created automatically, you must create it yourself, whether you use embedded or "real" 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

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.

And here's the Maven settings.xml Reference page

似狗非友 2024-10-18 04:59:10

在 Mac 上工作时,我遵循 Sean Patrick Floyd 的答案,在我的用户文件夹 /Users/user/.m2/ 中放置了一个像上面这样的 settings.xml

但这没有帮助。所以我打开了一个终端并对文件夹执行了 ls -la 操作。这表明

-rw-r--r--@

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

-rw-r--rw-@

这样就完成了。消息消失了。

Working on Mac I followed the answer of Sean Patrick Floyd placing a settings.xml like above in my user folder /Users/user/.m2/

But this did not help. So I opened a Terminal and did a ls -la on the folder. This was showing

-rw-r--r--@

thus staff and everone can 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:

-rw-r--rw-@

This did it. The message disappeared.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文