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

时间:2022-09-03 22:53:26

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

干杯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)“Maven Integration for Eclipse”

2 个解决方案

#1


80  

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

在以下位置 <您的主文件夹> /。m2 / settings.xml创建它,例如Windows上的C:\ Users \ YourUserName \ .m2 \ settings.xml或Linux上的/home/YourUserName/.m2/settings.xml

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

这是Maven settings.xml参考页面

#2


0  

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的回答将上面的settings.xml放在我的用户文件夹/Users/user/.m2/中

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

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

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

这样做了。消息消失了。

#1


80  

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

在以下位置 <您的主文件夹> /。m2 / settings.xml创建它,例如Windows上的C:\ Users \ YourUserName \ .m2 \ settings.xml或Linux上的/home/YourUserName/.m2/settings.xml

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

这是Maven settings.xml参考页面

#2


0  

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的回答将上面的settings.xml放在我的用户文件夹/Users/user/.m2/中

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

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

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

这样做了。消息消失了。