简体   繁体   English

将 Maven 包的源上传到 MyGet 存储库

[英]Upload Maven package's sources to MyGet repository

I am using Eclipse and Maven to create a Maven package that is uploaded to MyGet to be consumed by other users.我正在使用 Eclipse 和 Maven 创建一个 Maven 包,该包上传到 MyGet 以供其他用户使用。 I would like to make it so that when my package is referenced as a dependency and therefore downloaded from MyGet, the source attachment is also downloaded.我想这样做,以便当我的包被引用为依赖项并因此从 MyGet 下载时,源附件也会被下载。

I've seen this happen with, for example, the JOGL library - when my Maven project in Eclipse references JOGL, I end up with the following files in the ~/.m2/repository subdirectory associated with JOGL (among others):例如,我在 JOGL 库中看到了这种情况——当我在 Eclipse 中的 Maven 项目引用 JOGL 时,我最终在与 JOGL 关联的 ~/.m2/repository 子目录中得到以下文件(以及其他文件):

  • jogl-all-main-2.3.2.jar jogl-all-main-2.3.2.jar
  • jogl-all-main-2.3.2-sources.jar jogl-all-main-2.3.2-sources.jar

And in Eclipse, if I right click on the jogl-all-main-2.3.2.jar library and choose Properties, it shows the source attachment as jogl-all-main-2.3.2-sources.jar located in my .m2 folder.在 Eclipse 中,如果我右键单击 jogl-all-main-2.3.2.jar 库并选择“属性”,它会将源附件显示为位于我的.m2 jogl-all-main-2.3.2-sources.jar文件夹。 I don't believe that I did anything to select that file as the source attachment;我不相信我做了任何选择该文件作为源附件的事情; I think it happened automatically.我认为它是自动发生的。

When I upload my package to MyGet, it allows me to upload one or more jar files, but it expects each jar file to be a Maven package including a pom.xml file, so I can't upload the sources jar file to MyGet directly.当我将我的包上传到 MyGet 时,它允许我上传一个或多个 jar 文件,但它希望每个 jar 文件都是一个包含 pom.xml 文件的 Maven 包,因此我无法将源 jar 文件直接上传到 MyGet .

Perhaps this is a limitation of MyGet, in that it doesn't allow me to upload the sources in parallel.也许这是 MyGet 的一个限制,因为它不允许我并行上传源。 I'm not familiar enough with Maven to know if it's something that I need to specify in the pom.xml for my package.我对 Maven 不够熟悉,不知道是否需要在pom.xml为我的包指定某些内容。

Please check this answer .请检查这个答案 I believe MyGet should support standard Maven's command:我相信 MyGet 应该支持标准 Maven 的命令:

mvn clean javadoc:jar source:jar deploy 

So please try configure your MyGet's repo as registry and upload your packages using Maven's CLI intead of MyGet's GUI.因此,请尝试将您的 MyGet 的 repo 配置为注册表,并使用 Maven 的 CLI 而非 MyGet 的 GUI 上传您的包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM