You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2005/11/17 21:16:43 UTC
svn commit: r345319 -
/maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
Author: jdcasey
Date: Thu Nov 17 12:16:38 2005
New Revision: 345319
URL: http://svn.apache.org/viewcvs?rev=345319&view=rev
Log:
PR: MNG-1396
Submitted By: Juraj Burian
Reviewed By: John Casey
Applied the patch, with some changes. Thanks for the contribution, Juraj.
This fix allows customized inclusions and exclusions of files to be added to the ejb-client jar. The patch had these parameters using a comma-delimited list, but I've changed them to work more like <resource/>'s, in that they use a list of single include/exclude patterns. The configuration will look like this:
<configuration>
<clientIncludes>
<clientInclude>**/ClientSession.class</clientInclude>
</clientIncludes
<clientExcludes>
<clientExclude>**/ServerOnly.class</clientExclude>
</clientExcludes>
</configuration>
Modified:
maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
Modified: maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java?rev=345319&r1=345318&r2=345319&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java Thu Nov 17 12:16:38 2005
@@ -25,6 +25,7 @@
import org.codehaus.plexus.archiver.jar.JarArchiver;
import java.io.File;
+import java.util.List;
/**
* Build an EJB (and optional client) from the current project.
@@ -44,6 +45,8 @@
private static final String[] DEFAULT_EXCLUDES = new String[]{"**/*Bean.class", "**/*CMP.class",
"**/*Session.class", "**/package.html"};
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
/**
* The directory for the generated EJB.
*
@@ -78,6 +81,37 @@
* @todo boolean instead
*/
private String generateClient = Boolean.FALSE.toString();
+
+ /**
+ * Excludes.
+ *
+ * <br/>Usage:
+ * <pre>
+ * <clientExcludes>
+ * <clientExclude>**/*Ejb.class</clientExclude>
+ * <clientExclude>**/*Bean.class</clientExclude>
+ * </clientExcludes>
+ * </pre>
+ * <br/>Attribute is used only if client jar is generated.
+ * <br/>Default exclusions: **/*Bean.class, **/*CMP.class, **/*Session.class, **/package.html
+ * @parameter
+ */
+ private List clientExcludes;
+
+ /**
+ * Includes.
+ *
+ * <br/>Usage:
+ * <pre>
+ * <clientIncludes>
+ * <clientInclude>**/*</clientInclude>
+ * </clientIncludes>
+ * </pre>
+ * <br/>Attribute is used only if client jar is generated.
+ * <br/>Default value: **/**
+ * @parameter
+ */
+ private List clientIncludes;
/**
* The maven project.
@@ -156,6 +190,20 @@
{
getLog().info( "Building ejb client " + jarName + "-client" );
+ String[] excludes = DEFAULT_EXCLUDES;
+ String[] includes = DEFAULT_INCLUDES;
+
+ if ( clientIncludes != null && !clientIncludes.isEmpty() )
+ {
+ includes = (String[]) clientIncludes.toArray( EMPTY_STRING_ARRAY );
+ }
+
+ if ( clientExcludes != null && !clientExcludes.isEmpty() )
+ {
+ excludes = (String[]) clientExcludes.toArray( EMPTY_STRING_ARRAY );
+ }
+
+
File clientJarFile = new File( basedir, jarName + "-client.jar" );
MavenArchiver clientArchiver = new MavenArchiver();
@@ -164,8 +212,8 @@
clientArchiver.setOutputFile( clientJarFile );
- clientArchiver.getArchiver().addDirectory( new File( outputDirectory ), DEFAULT_INCLUDES,
- DEFAULT_EXCLUDES );
+ clientArchiver.getArchiver().addDirectory(
+ new File( outputDirectory ), includes, excludes );
// create archive
clientArchiver.createArchive( project, archive );
@@ -180,5 +228,4 @@
throw new MojoExecutionException( "Error assembling EJB", e );
}
}
-
}