maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moritz Havelock (JIRA)" <j...@codehaus.org>
Subject [jira] Created: (MSOURCES-39) Add a includePom option to the sources:jar goal
Date Wed, 03 Sep 2008 18:42:48 GMT
Add a includePom option to the sources:jar goal
-----------------------------------------------

                 Key: MSOURCES-39
                 URL: http://jira.codehaus.org/browse/MSOURCES-39
             Project: Maven 2.x Source Plugin
          Issue Type: Improvement
            Reporter: Moritz Havelock
            Priority: Minor


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();



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message