Maven Source Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
=Generating the source jar=
=Generating the source jar=


{{{
<pre>
   <build>
   <build>
     <plugins>
     <plugins>
Line 23: Line 23:
     </plugins>
     </plugins>
   </build>
   </build>
}}}
</pre>





Revision as of 08:25, 28 January 2016

Internal

Generating the source jar

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


If the "maven-source-plugin" is active, maven install will also install the source jar.

!!!Installing the source artifact in the repository post factum


mvn install:install-file -DgroupId=my.group -DartifactId=my-file -Dversion=1.0 \
  -Dpackaging=jar -Dclassifier=source -Dfile=./my-file-src.jar