Thursday 24 November 2011

Maven: Attach Source Code + Javadoc in output jar

Maven: Attach Source Code / Javadoc in output jar

<!-- 
	Attach the source to the output jar.
	Execute with "mvn source:jar".
	http://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html
 -->
<plugin>
  <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>

<!-- 
	Attach the javadoc to the output jar.
	Execute with "mvn javadoc:jar".
	http://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html
 -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <executions>
    <execution>
      <id>attach-javadocs</id>
      <goals>
        <goal>jar</goal>
      </goals>
    </execution>
  </executions>
</plugin>
Execute "mvn install" to place the output jars in the local repository (default: ~/.m2/repository)

Apache

No comments:

Post a Comment