Hello,

attached you will find a patch that will allow the maven-war-plugin
to add a ejb-client created by the maven-ejb-plugin. With the
latest cvs snapshot it is not possible to add the ejb client to the
war, always the ejb.jar will be added to the war file what is not
really inteded.

this dependency will only add the ejb(server).jar to the war file.
What i really want is that the created ejb-client.jar  is added to the war.
adding the ejb(server).jar to the war file does not make sense for the war file. (the maven-ejb-plugin created a server and client version for the de.blubb.project_name.ejb projekt,
 which is actually another module of my project)
<dependency>
         <groupId>de.blubb.project_name</groupId>
        <artifactId>ejb</artifactId>
        <version>1.0</version>
        <type>ejb-client</type>
</dependency>

If the patch is obsolete, i was wondering if there is anybody out
there who is using the maven-ejb-plugin in combination with
the maven-war-plugin and is actually adding the
created ejb-client to the created war file successfully.

As far as i can tell the maven-ejb-plugin creates a client (if
requested) with the name <artifcat>-<version>-client.jar. however
the maven-war-plugin does not respect the "-client" in the client's
name. even if i set the "type" of the dependency to "ejb-client"
it is still getting the "ejb.jar", not the "ejb-client.jar". My
patch fixes this problem.

i can provide a testcase that shows the current problem, if requested.

feedback is really appreciated.

regards,
Andy

Index: 
D:/WSAD/DefaultWorkspace/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
===================================================================
--- 
D:/WSAD/DefaultWorkspace/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
        (revision 430070)
+++ 
D:/WSAD/DefaultWorkspace/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
        (working copy)
@@ -478,7 +478,7 @@
         File expectedWebSourceFile = new File( webAppDirectory, "pansit.jsp" );
         File expectedWebSource2File = new File( webAppDirectory, 
"org/web/app/last-exile.jsp" );
         // final name form is <artifactId>-<version>.<type>
-        File expectedEJBArtifact = new File( webAppDirectory, 
"WEB-INF/lib/ejbclientartifact-0.0-Test.jar" );
+        File expectedEJBArtifact = new File( webAppDirectory, 
"WEB-INF/lib/ejbclientartifact-0.0-Test-client.jar" );
 
         assertTrue( "source files not found: " + 
expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
         assertTrue( "source files not found: " + 
expectedWebSource2File.toString(), expectedWebSource2File.exists() );
@@ -488,7 +488,7 @@
         expectedWebSourceFile.delete();        
         expectedWebSource2File.delete();
         expectedEJBArtifact.delete();
-    }
+    } 
 
     /**
      * @throws Exception
Index: 
D:/WSAD/DefaultWorkspace/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
===================================================================
--- 
D:/WSAD/DefaultWorkspace/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
    (revision 430070)
+++ 
D:/WSAD/DefaultWorkspace/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
    (working copy)
@@ -1022,8 +1022,15 @@
      */
     private String getDefaultFinalName( Artifact artifact )
     {
-        return artifact.getArtifactId() + "-" + artifact.getVersion() + "." +
-            artifact.getArtifactHandler().getExtension();
+        String type = artifact.getType();
+        if ("ejb-client".equals( type )) {
+          return artifact.getArtifactId() + "-" + artifact.getVersion() + "-" 
+ "client" + 
+          "." + 
+          artifact.getArtifactHandler().getExtension();
+        } else {
+          return artifact.getArtifactId() + "-" + artifact.getVersion() + "." +
+          artifact.getArtifactHandler().getExtension();
+        }
     }
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to