blob: af20026a824cd3cdf1e06d7ae4214dd22463d716 [file] [log] [blame]
-----
Cookbook - How to attach source and javadoc artifacts
-----
Vincent Siveton
-----
January 2008
-----
Cookbook: How to attach source and javadoc artifacts?
* Summary
This recipe describes how to attach source and javadoc artifacts to your build.
* Prerequisite Plugins
Here is the list of the plugins used:
*-----------------------------------------------------------+--------------+
|| <<Plugin>> || <<Version>>
*-----------------------------------------------------------+--------------+
| {{{../../plugins/maven-source-plugin/} <<<source>>>}} | 2.0.4
*-----------------------------------------------------------+--------------+
| {{{../../plugins/maven-javadoc-plugin/} <<<javadoc>>>}} | 2.3
*-----------------------------------------------------------+--------------+
* Sample Generated Output
+-----+
attach-source-javadoc
|-- pom.xml
|-- src\
`-- target
`-- attach-source-javadoc-1.0-SNAPSHOT.jar
`-- attach-source-javadoc-1.0-SNAPSHOT-javadoc.jar
`-- attach-source-javadoc-1.0-SNAPSHOT-sources.jar
+-----+
* Recipe
** Configuring Maven Source Plugin
We execute the <<<{{{../../plugins/maven-source-plugin/jar-mojo.html}source:jar}}>>> goal from the source plugin during the <<<package>>> phase.
%{snippet|id=source|url=http://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/attach-source-javadoc/pom.xml}
** Configuring Maven Javadoc Plugin
Same thing for the <<<{{{../../plugins/maven-javadoc-plugin/jar-mojo.html}javadoc:jar}}>>> goal from the javadoc plugin.
%{snippet|id=javadoc|url=http://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/attach-source-javadoc/pom.xml}
** Running Maven
Just call Maven to generate the packages:
+-----+
mvn package
+-----+
* Other Tips
To improve the build time or for a release, you could also define these plugins in a profile.
* Resources
* Source code: {{{http://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/attach-source-javadoc}http://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/attach-source-javadoc}}
* {{{../../plugins/maven-javadoc-plugin/} Maven Javadoc Plugin}}
* {{{../../plugins/maven-source-plugin/} Maven Source Plugin}}
[]