[richfaces-svn-commits] JBoss Rich Faces SVN: r6462 - trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Feb 29 13:33:34 EST 2008


Author: nbelaevski
Date: 2008-02-29 13:33:34 -0500 (Fri, 29 Feb 2008)
New Revision: 6462

Modified:
   trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
Log:
excludeXcss parameter added to library assembly MOJO

Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java	2008-02-29 17:32:04 UTC (rev 6461)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java	2008-02-29 18:33:34 UTC (rev 6462)
@@ -54,12 +54,7 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.shared.io.scan.ResourceInclusionScanner;
-import org.apache.maven.shared.io.scan.SimpleResourceInclusionScanner;
 import org.apache.velocity.VelocityContext;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
 import org.codehaus.plexus.archiver.UnArchiver;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 import org.codehaus.plexus.util.DirectoryScanner;
@@ -210,12 +205,18 @@
 	/**
 	 * @parameter
 	 */
+	private String excludeXcss = null;
+
+	/**
+	 * @parameter
+	 */
 	private String commonStyle;
 
 	/**
 	 * @parameter
 	 */
 	private  String templateXpath;
+
 	/**
 	 * 
 	 */
@@ -239,15 +240,15 @@
 		mergeFacesConfig(models);
 		File resourcesConfig = new File(outputDirectory,
 				"META-INF/resources-config.xml");
-		mergeXML(models, "META-INF/resources-config.xml",
+		mergeXML(models, "META-INF/resources-config.xml", null,
 				RESOURCES_CONFIG_TEMPLATE, "/resource-config/resource",
 				"name/text()", new VelocityContext(), resourcesConfig, false);
 		if (null != commonStyle) {
 			File commonXcss = new File(outputDirectory, commonStyle);
-			mergeXML(models, includeXcss, XCSS_TEMPLATE, templateXpath, null,
-					new VelocityContext(), commonXcss, true);
+			mergeXML(models, includeXcss, excludeXcss, XCSS_TEMPLATE, 
+					templateXpath, null, new VelocityContext(), commonXcss, true);
+		}
 
-		}
 		if (null != library.getTaglibs() && library.getTaglibs().length > 0) {
 			for (int i = 0; i < library.getTaglibs().length; i++) {
 				Taglib taglib = library.getTaglibs()[i];
@@ -303,12 +304,12 @@
 		File tld = new File(outputDirectory, "META-INF/" + taglib.getTaglib()
 				+ ".tld");
 		getLog().debug("Write JSP taglib " + tld.getPath());
-		mergeXML(models, includeTld, TLD_TEMPLATE, "/taglib/tag"
+		mergeXML(models, includeTld, null, TLD_TEMPLATE, "/taglib/tag"
 				+ createTagCondition(taglib, "name") + " | /taglib/listener",
 				null, new VelocityContext(taglibContext), tld, false);
 		File faceletsTaglib = new File(outputDirectory, "META-INF/"
 				+ taglib.getTaglib() + ".taglib.xml");
-		mergeXML(models, includeTaglib, TAGLIB_TEMPLATE, "/facelet-taglib/tag"
+		mergeXML(models, includeTaglib, null, TAGLIB_TEMPLATE, "/facelet-taglib/tag"
 				+ createTagCondition(taglib, "tag-name")
 				+ " | /facelet-taglib/function", null, new VelocityContext(
 				taglibContext), faceletsTaglib, false);
@@ -597,22 +598,23 @@
 	 *            {@link Set} to check for duplicate keys. Must not be null
 	 * @throws MojoExecutionException
 	 */
-	private void mergeXML(List models, String filename, String templateName,
+	private void mergeXML(List models, String filename, String excludes, String templateName,
 			String commonXpath, String keyXPath, VelocityContext context,
 			File target, boolean namespaceAware) throws MojoExecutionException {
 		Set<String> keySet = new HashSet<String>();
 		StringBuffer content = new StringBuffer();
 		List<XMLBody> xmls = new ArrayList<XMLBody>(models.size());
 		String[] split = filename.split(",");
+		String[] excludesSplit = excludes != null ? excludes.split(",") : null;
 		for (Iterator iter = models.iterator(); iter.hasNext();) {
 			Model model = (Model) iter.next();
 			File moduleDir = new File(modulesDirectory, model.getArtifactId());
 			mergeXMLdir(moduleDir, commonXpath, keyXPath, namespaceAware,
-					keySet, content, xmls, split);
+					keySet, content, xmls, split, excludesSplit);
 		}
 		if(null!=config){
 			mergeXMLdir(config, commonXpath, keyXPath, namespaceAware,
-					keySet, content, xmls, split);			
+					keySet, content, xmls, split, excludesSplit);			
 		}
 		if (xmls.size() > 0) {
 			context.put("content", content.toString());
@@ -643,12 +645,13 @@
 	 */
 	private void mergeXMLdir(File moduleDir, String commonXpath,
 			String keyXPath, boolean namespaceAware, Set<String> keySet,
-			StringBuffer content, List<XMLBody> xmls, String[] split)
+			StringBuffer content, List<XMLBody> xmls, String[] split, String[] excludesSplit)
 			throws IllegalStateException, MojoExecutionException {
 		DirectoryScanner ds = new DirectoryScanner();
 		ds.setFollowSymlinks(true);
 		ds.setBasedir(moduleDir);
 		ds.setIncludes(split);
+		ds.setExcludes(excludesSplit);
 		ds.addDefaultExcludes();
 		ds.scan();
 		String[] files = ds.getIncludedFiles();




More information about the richfaces-svn-commits mailing list