Author: dennisl
Date: Thu Feb 12 13:02:55 2009
New Revision: 743716

URL: http://svn.apache.org/viewvc?rev=743716&view=rev
Log:
[MWAR-80] Classifier in jar file name is removed once assembled into war file

o Documented the current behavior better.
o Added a test case to verify that the classifier of a dependency is not lost 
in translation.

Modified:
    
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
    maven/plugins/trunk/maven-war-plugin/src/site/fml/faq.fml
    
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/MappingUtilsTest.java

Modified: 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java?rev=743716&r1=743715&r2=743716&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
 Thu Feb 12 13:02:55 2009
@@ -64,7 +64,8 @@
     private String warName;
 
     /**
-     * Classifier to add to the artifact generated. If given, the artifact 
will be an attachment instead.
+     * Classifier to add to the generated WAR. If given, the artifact will be 
an attachment instead.
+     * The classifier will not be applied to the jar file of the project - 
only to the war file.
      *
      * @parameter
      */
@@ -187,7 +188,7 @@
 
         getLog().debug(
             "Excluding " + Arrays.asList( getPackagingExcludes() ) + " for the 
generated webapp archive." );
-        
+
         warArchiver.addDirectory( getWebappDirectory(), new String[]{"**"}, 
getPackagingExcludes() );
 
         final File webXmlFile = new File( getWebappDirectory(), 
"WEB-INF/web.xml" );

Modified: maven/plugins/trunk/maven-war-plugin/src/site/fml/faq.fml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/site/fml/faq.fml?rev=743716&r1=743715&r2=743716&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/site/fml/faq.fml (original)
+++ maven/plugins/trunk/maven-war-plugin/src/site/fml/faq.fml Thu Feb 12 
13:02:55 2009
@@ -39,9 +39,9 @@
      </answer>
    </faq>
    <faq id="classifieruse">
-     <question>How does the classifier affect artifacts in my war 
project?</question>
+     <question>How does the classifier of dependency artifacts affect my war 
project?</question>
      <answer>
-       <p>When used, the copy of the artifact in your project will have the 
classifier appended to its
+       <p>When used, the copy of the dependency artifact in your project will 
have the classifier appended to its
        filename. This can be used to differentiate duplicate artifacts.</p>
      </answer>
    </faq>

Modified: 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/MappingUtilsTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/MappingUtilsTest.java?rev=743716&r1=743715&r2=743716&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/MappingUtilsTest.java
 (original)
+++ 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/MappingUtilsTest.java
 Thu Feb 12 13:02:55 2009
@@ -22,6 +22,7 @@
 import junit.framework.TestCase;
 
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.war.AbstractWarMojo;
 import org.apache.maven.plugin.war.stub.AbstractArtifactStub;
 import org.codehaus.plexus.interpolation.InterpolationException;
 
@@ -69,6 +70,18 @@
 
     }
 
+    public void testMappingWithClassifier()
+        throws MojoExecutionException, InterpolationException
+    {
+        TestArtifactStub jar = new TestArtifactStub();
+        jar.setGroupId( "org.apache.sample" );
+        jar.setArtifactId( "maven-test-lib" );
+        jar.setVersion( "1.0" );
+        jar.setClassifier( "classifier" );
+        assertEquals( "maven-test-lib-1.0-classifier.jar",
+                      MappingUtils.evaluateFileNameMapping( 
AbstractWarMojo.DEFAULT_FILE_NAME_MAPPING_CLASSIFIER, jar ) );
+    }
+
 
     // A very dumb stub used to test the mappings
     class TestArtifactStub


Reply via email to