Author: rec
Date: Fri May 31 17:22:22 2013
New Revision: 1488324

URL: http://svn.apache.org/r1488324
Log:
[UIMA-2953] jcasgen-maven-plugin needs to support patterns
- Added support for Maven-style include/excludes. Includes are mandatory.
- Old style not supported anymore.
- This changes the configuration style. No problem, since this is a new plugin 
that nobody uses yet. No need to stay backwards compatible here.

Added:
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/pom.xml   
(with props)
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Sentence.xml
   (with props)
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Token.xml
   (with props)
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/pom.xml   
(with props)
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Sentence.xml
   (with props)
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Token.xml
   (with props)
Modified:
    uima/uimaj/trunk/jcasgen-maven-plugin/src/it/classpath/pom.xml
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/classpath/pom.xml
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref1/pom.xml
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref2/pom.xml
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/simple/pom.xml
    uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref1/pom.xml
    uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref2/pom.xml
    uima/uimaj/trunk/jcasgen-maven-plugin/src/it/simple/pom.xml
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
    
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/classpath/pom.xml
    uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/simple/pom.xml

Modified: uima/uimaj/trunk/jcasgen-maven-plugin/src/it/classpath/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/classpath/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/it/classpath/pom.xml (original)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/it/classpath/pom.xml Fri May 31 
17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/classpath/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/classpath/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/classpath/pom.xml
 (original)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/classpath/pom.xml
 Fri May 31 17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref1/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref1/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref1/pom.xml
 (original)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref1/pom.xml
 Fri May 31 17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/type/Token.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/type/Token.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref2/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref2/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref2/pom.xml
 (original)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/crossref2/pom.xml
 Fri May 31 17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/simple/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/simple/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/simple/pom.xml
 (original)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/m2e/projects/jcasgen/simple/pom.xml
 Fri May 31 17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref1/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref1/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref1/pom.xml 
(original)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref1/pom.xml 
Fri May 31 17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/type/Token.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/type/Token.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref2/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref2/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref2/pom.xml 
(original)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/it/multimodule/crossref2/pom.xml 
Fri May 31 17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: uima/uimaj/trunk/jcasgen-maven-plugin/src/it/simple/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/it/simple/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/it/simple/pom.xml (original)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/it/simple/pom.xml Fri May 31 
17:22:22 2013
@@ -29,7 +29,9 @@
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>@project.version@</version>
                                <configuration>
-                                       
<typeSystem>src/main/resources/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
 (original)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java
 Fri May 31 17:22:22 2013
@@ -19,10 +19,13 @@
 package org.apache.uima.tools.jcasgen.maven;
 
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -41,15 +44,19 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.project.MavenProject;
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.resource.ResourceManager;
+import org.apache.uima.resource.metadata.Import;
 import org.apache.uima.resource.metadata.TypeDescription;
 import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.resource.metadata.impl.Import_impl;
+import org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl;
 import org.apache.uima.tools.jcasgen.IError;
 import org.apache.uima.tools.jcasgen.IProgressMonitor;
 import org.apache.uima.tools.jcasgen.Jg;
 import org.apache.uima.util.InvalidXMLException;
-import org.apache.uima.util.XMLInputSource;
 import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.IOUtil;
 import org.sonatype.plexus.build.incremental.BuildContext;
+import org.xml.sax.SAXException;
 
 /**
  * Applies JCasGen to create Java files from XML type system descriptions.
@@ -69,10 +76,16 @@ public class JCasGenMojo
     private BuildContext buildContext;
 
     /**
-     * The path to the XML type system description.
+     * Type system descriptors to be included in JCas generation.
      */
     @Parameter(required = true)
-    private String typeSystem;
+    private String[] typeSystemIncludes;
+
+    /**
+     * Type system descriptors to be excluded in JCas generation.
+     */
+    @Parameter(required = false)
+    private String[] typeSystemExcludes;
 
     /**
      * The directory where the generated sources will be written.
@@ -84,7 +97,6 @@ public class JCasGenMojo
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-
         // add the generated sources to the build
         if (!this.outputDirectory.exists()) {
             this.outputDirectory.mkdirs();
@@ -92,9 +104,6 @@ public class JCasGenMojo
         }
         this.project.addCompileSourceRoot(this.outputDirectory.getPath());
 
-        // the type system is relative to the base directory
-        File typeSystemFile = new File(this.project.getBasedir(), 
this.typeSystem);
-
         // assemble the classpath
         List<String> elements;
         try {
@@ -112,23 +121,73 @@ public class JCasGenMojo
         }
         String classpath = classpathBuilder.toString();
 
-        // skip JCasGen if there are no changes in the type system file or the 
files it references
-        if (!this.buildContext.hasDelta(this.typeSystem)
-                && !this.hasDelta(typeSystemFile, classpath)) {
-            this.getLog().info("JCasGen: Skipped, since no type system changes 
were detected");
-            return;
-        }
-
-        // run JCasGen to generate the Java sources
-        Jg jCasGen = new Jg();
-        String[] args = new String[] { "-jcasgeninput", 
typeSystemFile.toString(),
-                "-jcasgenoutput", this.outputDirectory.getAbsolutePath(), 
"=jcasgenclasspath",
-                classpath };
+        // Locate the files to include
+        DirectoryScanner ds = new DirectoryScanner();
+        ds.setIncludes(typeSystemIncludes);
+        ds.setExcludes(typeSystemExcludes);
+        ds.setBasedir(this.project.getBasedir());
+        ds.setCaseSensitive(true);
+        ds.scan();
+
+        // Create a merged type system and check if any of the files has a 
delta
+        TypeSystemDescription typeSystem = new TypeSystemDescription_impl();
+        List<Import> imports = new ArrayList<Import>();
+        boolean contextDelta = false;
+        for (String descriptorLocation : ds.getIncludedFiles()) {
+            Import imp = new Import_impl();
+            imp.setLocation(new File(ds.getBasedir(), 
descriptorLocation).getAbsolutePath());
+            imports.add(imp);
+            
+            contextDelta |= this.buildContext
+                    .hasDelta(new File(ds.getBasedir(), descriptorLocation));
+        }
+        Import[] importArray = new Import[imports.size()];
+        typeSystem.setImports(imports.toArray(importArray));
+
+        // Save type system to a file so we can pass it to the Jg
+        // Do this before resolving the imports
+        File typeSystemFile = null;
         try {
-            jCasGen.main0(args, null, new JCasGenProgressMonitor(), new 
JCasGenErrors());
+            OutputStream typeSystemOs = null;
+            try {
+                typeSystemFile = 
File.createTempFile("jcasgen-aggregate-types", ".xml");
+                typeSystemOs = new FileOutputStream(typeSystemFile);
+                typeSystem.toXML(typeSystemOs);
+            }
+            catch (IOException e) {
+                throw new MojoExecutionException(e.getMessage(), e.getCause());
+            }
+            catch (SAXException e) {
+                throw new MojoExecutionException(e.getMessage(), e.getCause());
+            }
+            finally {
+                IOUtil.close(typeSystemOs);
+            }
+    
+            // skip JCasGen if there are no changes in the type system file or 
the files it
+            // references
+            // hasDelta resolves the imports!
+            if (!contextDelta && !this.hasDelta(typeSystem, classpath)) {
+                this.getLog().info("JCasGen: Skipped, since no type system 
changes were detected");
+                return;
+            }
+            
+            // run JCasGen to generate the Java sources
+            Jg jCasGen = new Jg();
+            String[] args = new String[] { "-jcasgeninput", 
typeSystemFile.getAbsolutePath(),
+                    "-jcasgenoutput", this.outputDirectory.getAbsolutePath(), 
"=jcasgenclasspath",
+                    classpath };
+            try {
+                jCasGen.main0(args, null, new JCasGenProgressMonitor(), new 
JCasGenErrors());
+            }
+            catch (JCasGenException e) {
+                throw new MojoExecutionException(e.getMessage(), e.getCause());
+            }
         }
-        catch (JCasGenException e) {
-            throw new MojoExecutionException(e.getMessage(), e.getCause());
+        finally {
+            if (typeSystemFile != null) {
+                typeSystemFile.delete();
+            }
         }
 
         // signal that the output directory has changed
@@ -203,13 +262,13 @@ public class JCasGenMojo
         }
     }
 
-    private boolean hasDelta(File typeSystemFile, String classpath)
+    private boolean hasDelta(TypeSystemDescription typeSystemDescription, 
String classpath)
     {
         // load the type system and resolve the imports using the classpath
-        TypeSystemDescription typeSystemDescription;
+//        TypeSystemDescription typeSystemDescription;
         try {
-            XMLInputSource in = new 
XMLInputSource(typeSystemFile.toURI().toURL());
-            typeSystemDescription = 
UIMAFramework.getXMLParser().parseTypeSystemDescription(in);
+//            XMLInputSource in = new 
XMLInputSource(typeSystemFile.toURI().toURL());
+//            typeSystemDescription = 
UIMAFramework.getXMLParser().parseTypeSystemDescription(in);
             ResourceManager resourceManager = 
UIMAFramework.newDefaultResourceManager();
             resourceManager.setExtensionClassPath(classpath, true);
             typeSystemDescription.resolveImports(resourceManager);
@@ -221,9 +280,9 @@ public class JCasGenMojo
         catch (MalformedURLException e) {
             return false;
         }
-        catch (IOException e) {
-            return false;
-        }
+//        catch (IOException e) {
+//            return false;
+//        }
 
         File buildOutputDirectory = new 
File(this.project.getBuild().getOutputDirectory());
 

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java
 (original)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java
 Fri May 31 17:22:22 2013
@@ -19,6 +19,8 @@
 package org.apache.uima.tools.jcasgen.maven;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 
 import junit.framework.Assert;
 
@@ -30,19 +32,27 @@ import org.apache.maven.plugin.testing.A
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
 import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.uima.tools.jcasgen.maven.JCasGenMojo;
+import org.codehaus.plexus.util.DirectoryScanner;
 
 public class JCasGenMojoTest extends AbstractMojoTestCase {
 
   public void testSimple() throws Exception {
-    this.test("simple");
+    this.test("simple", "type.span.Sentence", "type.span.Token", 
"type.relation.Dependency");
   }
 
   public void testClasspath() throws Exception {
-    this.test("classpath");
+    this.test("classpath", "type.span.Sentence", "type.span.Token", 
"type.relation.Dependency");
   }
 
-  public void test(String projectName) throws Exception {
+  public void testWildcard() throws Exception {
+    this.test("wildcard", "type.span.Sentence", "type.span.Token");
+  }
+
+  public void testExclude() throws Exception {
+    this.test("exclude", "type.span.Sentence");
+  }
+
+  public void test(String projectName, String... types) throws Exception {
 
     File projectDirectory = getTestFile("src/test/resources/" + projectName);
     File buildDirectory = getTestFile("target/project-" + projectName + 
"-test");
@@ -81,12 +91,30 @@ public class JCasGenMojoTest extends Abs
 
     // check that the Java files have been generated
     File jCasGenDirectory = new File(buildDirectory, 
"generated-sources/jcasgen");
-    Assert.assertTrue(new File(jCasGenDirectory + 
"/type/span/Sentence.java").exists());
-    Assert.assertTrue(new File(jCasGenDirectory + 
"/type/span/Sentence_Type.java").exists());
-    Assert.assertTrue(new File(jCasGenDirectory + 
"/type/span/Token.java").exists());
-    Assert.assertTrue(new File(jCasGenDirectory + 
"/type/span/Token_Type.java").exists());
-    Assert.assertTrue(new File(jCasGenDirectory + 
"/type/relation/Dependency.java").exists());
-    Assert.assertTrue(new File(jCasGenDirectory + 
"/type/relation/Dependency_Type.java").exists());
+    
+    // Record all the files that were generated
+    DirectoryScanner ds = new DirectoryScanner();
+    ds.setBasedir(jCasGenDirectory);
+    ds.setIncludes(new String[] { "**/*.java" });
+    ds.scan();
+    List<File> files = new ArrayList<File>();
+    for (String scannedFile : ds.getIncludedFiles()) {
+      files.add(new File(ds.getBasedir(), scannedFile));
+    }
+    
+    for (String type : types) {
+      File wrapperFile = new File(jCasGenDirectory + "/" + type.replace('.', 
'/') + ".java");
+      File typeFile = new File(jCasGenDirectory + "/" + type.replace('.', '/') 
+ "_Type.java");
+      
+      Assert.assertTrue(files.contains(wrapperFile));
+      Assert.assertTrue(files.contains(typeFile));
+      
+      files.remove(wrapperFile);
+      files.remove(typeFile);
+    }
+    
+    // check that no extra files were generated
+    Assert.assertTrue(files.isEmpty());
 
     // check that the generated sources are on the compile path
     
Assert.assertTrue(project.getCompileSourceRoots().contains(jCasGenDirectory.getAbsolutePath()));

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/classpath/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/classpath/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/classpath/pom.xml 
(original)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/classpath/pom.xml 
Fri May 31 17:22:22 2013
@@ -22,20 +22,15 @@
        <groupId>test</groupId>
        <artifactId>classpath</artifactId>
        <version>1.0.0-SNAPSHOT</version>
-       <dependencies>
-               <dependency>
-                       <groupId>org.apache.uima</groupId>
-                       <artifactId>uimaj-core</artifactId>
-                       <version>2.4.0</version>
-               </dependency>
-       </dependencies>
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.uima</groupId>
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <configuration>
-                                       
<typeSystem>src/main/resources/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Added: uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/pom.xml?rev=1488324&view=auto
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/pom.xml 
(added)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/pom.xml 
Fri May 31 17:22:22 2013
@@ -0,0 +1,48 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>test</groupId>
+       <artifactId>classpath</artifactId>
+       <version>1.0.0-SNAPSHOT</version>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.uima</groupId>
+                               <artifactId>jcasgen-maven-plugin</artifactId>
+                               <configuration>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/type/**/*.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
+                                       <typeSystemExcludes>
+                                               
<typeSystemExclude>src/main/resources/type/**/Token.xml</typeSystemExclude>
+                                       </typeSystemExcludes>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>generate</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
\ No newline at end of file

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Sentence.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Sentence.xml?rev=1488324&view=auto
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Sentence.xml
 (added)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Sentence.xml
 Fri May 31 17:22:22 2013
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier";>
+  <name>TypeSystem</name>
+  <description/>
+  <version>1.0</version>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>type.span.Sentence</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+    </typeDescription>
+  </types>
+</typeSystemDescription>

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Sentence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Sentence.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Token.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Token.xml?rev=1488324&view=auto
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Token.xml
 (added)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Token.xml
 Fri May 31 17:22:22 2013
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier";>
+  <name>TypeSystem</name>
+  <description/>
+  <version>1.0</version>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>type.span.Token</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>partOfSpeech</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+  </types>
+</typeSystemDescription>

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Token.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/exclude/src/main/resources/type/Token.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/simple/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/simple/pom.xml?rev=1488324&r1=1488323&r2=1488324&view=diff
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/simple/pom.xml 
(original)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/simple/pom.xml Fri 
May 31 17:22:22 2013
@@ -22,20 +22,15 @@
        <groupId>test</groupId>
        <artifactId>simple</artifactId>
        <version>1.0.0-SNAPSHOT</version>
-       <dependencies>
-               <dependency>
-                       <groupId>org.apache.uima</groupId>
-                       <artifactId>uimaj-core</artifactId>
-                       <version>2.4.0</version>
-               </dependency>
-       </dependencies>
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.uima</groupId>
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <configuration>
-                                       
<typeSystem>type/TypeSystem.xml</typeSystem>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>type/TypeSystem.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>

Added: uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/pom.xml?rev=1488324&view=auto
==============================================================================
--- uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/pom.xml 
(added)
+++ uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/pom.xml 
Fri May 31 17:22:22 2013
@@ -0,0 +1,45 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>test</groupId>
+       <artifactId>classpath</artifactId>
+       <version>1.0.0-SNAPSHOT</version>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.uima</groupId>
+                               <artifactId>jcasgen-maven-plugin</artifactId>
+                               <configuration>
+                                       <typeSystemIncludes>
+                                               
<typeSystemInclude>src/main/resources/type/**/*.xml</typeSystemInclude>
+                                       </typeSystemIncludes>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>generate</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
\ No newline at end of file

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Sentence.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Sentence.xml?rev=1488324&view=auto
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Sentence.xml
 (added)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Sentence.xml
 Fri May 31 17:22:22 2013
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier";>
+  <name>TypeSystem</name>
+  <description/>
+  <version>1.0</version>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>type.span.Sentence</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+    </typeDescription>
+  </types>
+</typeSystemDescription>

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Sentence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Sentence.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Token.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Token.xml?rev=1488324&view=auto
==============================================================================
--- 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Token.xml
 (added)
+++ 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Token.xml
 Fri May 31 17:22:22 2013
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier";>
+  <name>TypeSystem</name>
+  <description/>
+  <version>1.0</version>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>type.span.Token</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>partOfSpeech</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+  </types>
+</typeSystemDescription>

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Token.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
uima/uimaj/trunk/jcasgen-maven-plugin/src/test/resources/wildcard/src/main/resources/type/Token.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to