Upload Maven package's sources to MyGet repository

131 Views Asked by At

I am using Eclipse and Maven to create a Maven package that is uploaded to MyGet to be consumed by other users. 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.

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-all-main-2.3.2.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. 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.

Perhaps this is a limitation of MyGet, in that it doesn't allow me to upload the sources in parallel. 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.

1

There are 1 best solutions below

0
On BEST ANSWER

Please check this answer. I believe MyGet should support standard Maven's command:

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.