You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ke...@apache.org on 2006/03/03 15:18:56 UTC

svn commit: r382831 - /maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java

Author: kenney
Date: Fri Mar  3 06:18:56 2006
New Revision: 382831

URL: http://svn.apache.org/viewcvs?rev=382831&view=rev
Log:
Updated the copying of 'par' artifacts; the servlet container
does NOT automatically add '.par' files in the WEB-INF/lib/
directory to the classpath. So the copy will rename
the artifact to a .jar extension.

Note that the lastest public review of the Ejb3 spec
states that .par and .ejb3 archives should have a .jar
extension. There are some M2 complications in using 'jar'
as the type and/or file extension for ejb3 and par archives.
When those are resolved, the special par handling can be dropped.


Modified:
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java

Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java?rev=382831&r1=382830&r2=382831&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java Fri Mar  3 06:18:56 2006
@@ -349,10 +349,18 @@
                 {
                     FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
                 }
-                else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type )
-                    || "par".equals( type ) )
+                else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) )
                 {
                     FileUtils.copyFileToDirectory( artifact.getFile(), libDirectory );
+                }
+                else if ( "par".equals( type ) )
+                {
+                    String newName = artifact.getFile().getName();
+                    newName = newName.substring( 0, newName.lastIndexOf('.') ) + ".jar";
+
+                    getLog().debug( "Copying " + artifact.getFile() + " to " + new File( libDirectory, newName ) );
+
+                    FileUtils.copyFile( artifact.getFile(), new File( libDirectory, newName ) );
                 }
                 else if ( "war".equals( type ) )
                 {