Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.4
-
None
-
Patch
Description
Adds an includePom option that will result in inclusion of the project's pom file into the generates sources jar file.
Index: src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java (revision 691652) +++ src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.j +++ ava (working copy) @@ -69,6 +69,14 @@ * @since 2.0.4 */ protected boolean excludeResources; + + /** + * Specifies whether or not to include the pom file in the sources-jar. + * + * @parameter expression="${includePom}" default-value="false" + * @since 2.0.5 + */ + protected boolean includePom; /** * Used for attaching the source jar to the project. @@ -186,6 +194,15 @@ protected void archiveProjectContent( MavenProject project, Archiver archiver ) throws MojoExecutionException { + + if (includePom) { + try { + archiver.addFile(project.getFile(), project.getFile().getName()); + } catch (ArchiverException e) { + throw new MojoExecutionException("Error adding pom file to target jar file.", e); + } + } + for ( Iterator i = getSources( project ).iterator(); i.hasNext(); ) { String s = (String) i.next();