malaguna
malaguna

Reputation: 4233

Add sources to JitPack artifact

I have a public GitHub repository with a Maven managed project. I am using JitPack as Maven repo to deploy artifact versions, and it works like a charm.

However, I don't know how to add a new artifact with sources classifier. Someone knows how to do it?

Upvotes: 4

Views: 775

Answers (1)

Andrejs
Andrejs

Reputation: 27677

To add sources to a Maven project you need use the maven-source-plugin. If the project builds a sources jar then it will be published by JitPack.

Add this to pom.xml

<build>
  <plugins>
     <plugin>  <!-- Create sources.jar -->
        <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
   </plugin>
  </plugins>
</build>

For example https://github.com/jitpack/maven-simple/blob/master/pom.xml#L35-L46:

Upvotes: 3

Related Questions