m2eclipse 不会从本地存储库下载源代码

发布于 2024-08-02 21:20:06 字数 1126 浏览 11 评论 0原文

我在 Eclipse 中使用 Maven 来管理从本地存储库 (SNAPSHOT) 解析的项目依赖项。它可以很好地进行编译,但是当我尝试下载包的源代码(通过右键单击包和 Maven -> 下载源)时,它不起作用。

我得到的只是这个输出,但没有任何信息说明为什么插件不尝试下载源代码:

27.08.09 11:42:24 MESZ: [INFO] User settings file does not exist /home/my-name/.m2/settings.xml
27.08.09 11:42:24 MESZ: [DEBUG] Reading global settings from: /opt/shared/apache-maven/conf/settings.xml
27.08.09 11:42:24 MESZ: [DEBUG] Reading user settings from: null
27.08.09 11:42:24 MESZ: [DEBUG] Settings file is null. Returning null.

存储库中的文件如下所示:

Collection: /com/my-company/product/0.0.2-SNAPSHOT

# product-0.0.2-20090827.071202-1-sources.jar
# product-0.0.2-20090827.071202-1-sources.jar.md5
# product-0.0.2-20090827.071202-1-sources.jar.sha1
# product-0.0.2-20090827.071202-1.jar
# product-0.0.2-20090827.071202-1.jar.md5
# product-0.0.2-20090827.071202-1.jar.sha1
# product-0.0.2-20090827.071202-1.pom
# product-0.0.2-20090827.071202-1.pom.md5
# product-0.0.2-20090827.071202-1.pom.sha1
# maven-metadata.xml
# maven-metadata.xml.md5
# maven-metadata.xml.sha1

有人对源代码下载不起作用的原因有任何建议吗?

I am using Maven in Eclipse to manage the project dependencies which are resolved from a local repository (SNAPSHOT). It works fine for compiling, but when I am trying to download the sources of a package (via right-click on package and Maven -> Download Sources) it does not work.

All I am getting is this output, but no information why the plugin is not trying to download the sources:

27.08.09 11:42:24 MESZ: [INFO] User settings file does not exist /home/my-name/.m2/settings.xml
27.08.09 11:42:24 MESZ: [DEBUG] Reading global settings from: /opt/shared/apache-maven/conf/settings.xml
27.08.09 11:42:24 MESZ: [DEBUG] Reading user settings from: null
27.08.09 11:42:24 MESZ: [DEBUG] Settings file is null. Returning null.

The files at the repository look like this:

Collection: /com/my-company/product/0.0.2-SNAPSHOT

# product-0.0.2-20090827.071202-1-sources.jar
# product-0.0.2-20090827.071202-1-sources.jar.md5
# product-0.0.2-20090827.071202-1-sources.jar.sha1
# product-0.0.2-20090827.071202-1.jar
# product-0.0.2-20090827.071202-1.jar.md5
# product-0.0.2-20090827.071202-1.jar.sha1
# product-0.0.2-20090827.071202-1.pom
# product-0.0.2-20090827.071202-1.pom.md5
# product-0.0.2-20090827.071202-1.pom.sha1
# maven-metadata.xml
# maven-metadata.xml.md5
# maven-metadata.xml.sha1

Does anybody have any suggestions why the source download is not working?

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

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

发布评论

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

评论(3

御守 2024-08-09 21:20:06

我的maven安装驻留在版本文件夹中(例如/opt/shared/apache-maven-2.2.1),并且共享文件夹链接到该文件夹​​(例如/opt/shared/apache-maven)。可能是 Eclipse 或 m2eclipse 的符号链接有问题...

因为在我做了以下事情后问题就消失了:

  1. 更改了 Window->Preferences->Maven-> 下本地 Maven 安装的路径;安装从共享文件夹到版本文件夹
  2. 重试下载源将
  3. 本地Maven安装的路径再次更改为共享文件夹

我不知道到底发生了什么,但这神奇地解决了我的问题。

My maven-installation resides in a version folder (e.g. /opt/shared/apache-maven-2.2.1) and a shared folder is linked to that folder (e.g. /opt/shared/apache-maven). It might be that Eclipse or m2eclipse has problems with symbolic links ...

Because the problem went away after I did the following things:

  1. changed the path of the local Maven installation under Window->Preferences->Maven->Installations from the shared folder to the version folder
  2. Retried downloading sources
  3. changed the path of the local Maven installation to the shared folder again

I don't know what happened exactly, but this solved my problems magically.

酸甜透明夹心 2024-08-09 21:20:06

尝试在 m2Eclipse 问题 中搜索,有几个“下载源”问题
也许就是您描述的问题

try searching in the m2Eclipse Issues there are a couple of "Download Sources" Issues
Maybe this is the Problem you described

蓝戈者 2024-08-09 21:20:06

就我而言,可能也是OP的情况,错误/丢失的settings.xml文件很重要。如果您的存储库不可用(我的指定存储库由于某些安全相关原因而无法访问),Eclipse 将使用默认值。我从命令行指定了一个 --settings 值,但 Eclipse 没有得到此帮助。

一旦我正确编译了所有内容(不要忽略 Eclipse maven 构建错误),它就能够下载我的 Spring 源代码。希望我现在能做一些工作。

In my case, and possibly the OP's too, the bad/missing settings.xml file is important. Eclipse will use a default if yours isn't usable (mine specified repos that are inaccessible for some security related reason). From the command line I'd been specifying a --settings value and Eclipse wasn't getting this assistance.

Once I got everything to compile correctly (don't ignore the Eclipse maven build errors) then it was able to download my Spring sources. Hopefully I can do some work now.

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