You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Warren Crossing <wa...@mofokom.biz> on 2012/01/17 14:28:42 UTC

Patch to add optional attach flag to maven jar plugin.

Index: src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java 
     (revision 1232405)
+++ src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java 
     (working copy)
@@ -119,7 +119,17 @@
       */
      private boolean useDefaultManifestFile;

+
      /**
+     * Set this to <code>Fasle</code> to disable the attach of the 
<code>jar</code>.
+     *
+     * @parameter expression="${jar.attach}" default-value="true"
+     *
+     * @since 2.2
+     */
+    private boolean attach;
+
+    /**
       * @component
       */
      private MavenProjectHelper projectHelper;
@@ -235,11 +245,12 @@
          File jarFile = createArchive();

          String classifier = getClassifier();
-        if ( classifier != null )
+        if ( classifier != null && attach)
          {
              projectHelper.attachArtifact( getProject(), getType(), 
classifier, jarFile );
          }
-        else
+        else if(attach)
          {
              getProject().getArtifact().setFile( jarFile );
          }

Re: Patch to add optional attach flag to maven jar plugin.

Posted by Benson Margulies <bi...@gmail.com>.
And in this case, please also correct the spelling of Fasle.

On Tue, Jan 17, 2012 at 12:53 PM, Dennis Lundberg <de...@apache.org> wrote:
> Hi Warren
>
> Please attach any patches you have to issues in JIRA. They tend to get
> lost when sent to our mailing lists due to the amount of traffic. The
> address to JIRA for maven-jar-plugin is:
>
> http://jira.codehaus.org/browse/MJAR
>
> On 2012-01-17 14:28, Warren Crossing wrote:
>> Index: src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
>> ===================================================================
>> --- src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
>> (revision 1232405)
>> +++ src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
>> (working copy)
>> @@ -119,7 +119,17 @@
>>       */
>>      private boolean useDefaultManifestFile;
>>
>> +
>>      /**
>> +     * Set this to <code>Fasle</code> to disable the attach of the
>> <code>jar</code>.
>> +     *
>> +     * @parameter expression="${jar.attach}" default-value="true"
>> +     *
>> +     * @since 2.2
>> +     */
>> +    private boolean attach;
>> +
>> +    /**
>>       * @component
>>       */
>>      private MavenProjectHelper projectHelper;
>> @@ -235,11 +245,12 @@
>>          File jarFile = createArchive();
>>
>>          String classifier = getClassifier();
>> -        if ( classifier != null )
>> +        if ( classifier != null && attach)
>>          {
>>              projectHelper.attachArtifact( getProject(), getType(),
>> classifier, jarFile );
>>          }
>> -        else
>> +        else if(attach)
>>          {
>>              getProject().getArtifact().setFile( jarFile );
>>          }
>
>
> --
> Dennis Lundberg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Patch to add optional attach flag to maven jar plugin.

Posted by Dennis Lundberg <de...@apache.org>.
Hi Warren

Please attach any patches you have to issues in JIRA. They tend to get
lost when sent to our mailing lists due to the amount of traffic. The
address to JIRA for maven-jar-plugin is:

http://jira.codehaus.org/browse/MJAR

On 2012-01-17 14:28, Warren Crossing wrote:
> Index: src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
> ===================================================================
> --- src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    
> (revision 1232405)
> +++ src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    
> (working copy)
> @@ -119,7 +119,17 @@
>       */
>      private boolean useDefaultManifestFile;
> 
> +
>      /**
> +     * Set this to <code>Fasle</code> to disable the attach of the
> <code>jar</code>.
> +     *
> +     * @parameter expression="${jar.attach}" default-value="true"
> +     *
> +     * @since 2.2
> +     */
> +    private boolean attach;
> +
> +    /**
>       * @component
>       */
>      private MavenProjectHelper projectHelper;
> @@ -235,11 +245,12 @@
>          File jarFile = createArchive();
> 
>          String classifier = getClassifier();
> -        if ( classifier != null )
> +        if ( classifier != null && attach)
>          {
>              projectHelper.attachArtifact( getProject(), getType(),
> classifier, jarFile );
>          }
> -        else
> +        else if(attach)
>          {
>              getProject().getArtifact().setFile( jarFile );
>          }


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org