You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dennis Lundberg (JIRA)" <ji...@codehaus.org> on 2007/12/07 19:55:57 UTC

[jira] Updated: (MJAR-53) In pom with packaging "war" the generated jar will be installed in repo instead of the war

     [ http://jira.codehaus.org/browse/MJAR-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated MJAR-53:
--------------------------------

    Description: 
In pom with packaging "war" the generated jar will be installed in repo instead of the war! To solve this just do not set the file of project's artifact if it is already set and attach the jar artifact to the project's artifact. Here's the patch:

{code}
Index: D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
===================================================================
--- D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    (revision 425019)
+++ D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    (working copy)
@@ -166,7 +166,8 @@
         File jarFile = createArchive();
 
         String classifier = getClassifier();
-        if ( classifier != null )
+        if ( classifier != null 
+            || getProject().getArtifact().getFile() != null )
         {
             projectHelper.attachArtifact( getProject(), "jar", classifier, jarFile );
         }
{code}

I could also imagine to use a boolean property "allowOverrideProjectArtifact" which is true by default (current case).

Cheers,
Martin



  was:
In pom with packaging "war" the generated jar will be installed in repo instead of the war! To solve this just do not set the file of project's artifact if it is already set and attach the jar artifact to the project's artifact. Here's the patch:

Index: D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
===================================================================
--- D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    (revision 425019)
+++ D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    (working copy)
@@ -166,7 +166,8 @@
         File jarFile = createArchive();
 
         String classifier = getClassifier();
-        if ( classifier != null )
+        if ( classifier != null 
+            || getProject().getArtifact().getFile() != null )
         {
             projectHelper.attachArtifact( getProject(), "jar", classifier, jarFile );
         }

I could also imagine to use a boolean property "allowOverrideProjectArtifact" which is true by default (current case).

Cheers,
Martin




> In pom with packaging "war" the generated jar will be installed in repo instead of the war
> ------------------------------------------------------------------------------------------
>
>                 Key: MJAR-53
>                 URL: http://jira.codehaus.org/browse/MJAR-53
>             Project: Maven 2.x Jar Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1
>         Environment: WinXp
>            Reporter: Martin Zeltner
>            Priority: Blocker
>         Attachments: patch_jar-maven2-allow-override-project-artifact.txt
>
>
> In pom with packaging "war" the generated jar will be installed in repo instead of the war! To solve this just do not set the file of project's artifact if it is already set and attach the jar artifact to the project's artifact. Here's the patch:
> {code}
> Index: D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
> ===================================================================
> --- D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    (revision 425019)
> +++ D:/Programs/Maven2/maven/plugins/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java    (working copy)
> @@ -166,7 +166,8 @@
>          File jarFile = createArchive();
>  
>          String classifier = getClassifier();
> -        if ( classifier != null )
> +        if ( classifier != null 
> +            || getProject().getArtifact().getFile() != null )
>          {
>              projectHelper.attachArtifact( getProject(), "jar", classifier, jarFile );
>          }
> {code}
> I could also imagine to use a boolean property "allowOverrideProjectArtifact" which is true by default (current case).
> Cheers,
> Martin

-- 
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