Uploaded image for project: 'Maven Source Plugin'
  1. Maven Source Plugin
  2. MSOURCES-39

Add an includePom option to the sources:jar goal

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.4
    • 2.1
    • 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();
      

      Attachments

        Activity

          People

            dennisl@apache.org Dennis Lundberg
            m.havelock Moritz Havelock
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: