You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2021/11/24 17:40:34 UTC

[uima-uimafit] 01/01: [UIMA-6396] uimaFIT maven plugin mixes up test and compile scopes

This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch bugfix/UIMA-6396-uimaFIT-maven-plugin-mixes-up-test-and-compile-scopes
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 3ba4c194a2649601a074a7a8e75d56afbd4efeec
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Wed Nov 24 18:40:23 2021 +0100

    [UIMA-6396] uimaFIT maven plugin mixes up test and compile scopes
    
    - Added "includeScope" parameter to enhance and generate mojos with default value "compile"
    - Added integration tests checking that the new parameter works as expected for the "test" and "compile" scopes
---
 .../it/compile-test-scope/compile-artifact/pom.xml | 32 +++++++++
 .../META-INF/org.apache.uima.fit/types.txt         |  1 +
 .../apache/uima/fit/type/compileartifact/types.xml | 32 +++++++++
 .../main-artifact-plus-test-scope/pom.xml          | 79 ++++++++++++++++++++++
 .../src/main/java/TestAnnotator.java               | 33 +++++++++
 .../it/compile-test-scope/main-artifact/pom.xml    | 78 +++++++++++++++++++++
 .../main-artifact/src/main/java/TestAnnotator.java | 33 +++++++++
 .../src/it/compile-test-scope/pom.xml              | 42 ++++++++++++
 .../TestAnnotator.xml                              | 72 ++++++++++++++++++++
 .../reference/main-artifact/TestAnnotator.xml      | 62 +++++++++++++++++
 .../it/compile-test-scope/test-artifact/pom.xml    | 32 +++++++++
 .../META-INF/org.apache.uima.fit/types.txt         |  1 +
 .../apache/uima/fit/type/testartifact/types.xml    | 32 +++++++++
 .../src/it/compile-test-scope/verify.bsh           | 73 ++++++++++++++++++++
 .../org/apache/uima/fit/maven/EnhanceMojo.java     | 47 +++++++------
 .../uima/fit/maven/GenerateDescriptorsMojo.java    | 19 ++++--
 .../java/org/apache/uima/fit/maven/util/Util.java  | 35 +++++++++-
 17 files changed, 676 insertions(+), 27 deletions(-)

diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/pom.xml b/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/pom.xml
new file mode 100644
index 0000000..c8ab8e4
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/pom.xml
@@ -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.
+-->
+
+<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/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.uima.fit.maven.it</groupId>
+    <artifactId>default</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>compile-artifact</artifactId>
+</project>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/src/main/resources/META-INF/org.apache.uima.fit/types.txt b/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/src/main/resources/META-INF/org.apache.uima.fit/types.txt
new file mode 100644
index 0000000..1f3212d
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/src/main/resources/META-INF/org.apache.uima.fit/types.txt
@@ -0,0 +1 @@
+classpath*:org/apache/uima/fit/type/compileartifact/types.xml
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/src/main/resources/org/apache/uima/fit/type/compileartifact/types.xml b/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/src/main/resources/org/apache/uima/fit/type/compileartifact/types.xml
new file mode 100644
index 0000000..68daef7
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/compile-artifact/src/main/resources/org/apache/uima/fit/type/compileartifact/types.xml
@@ -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>Compile Types</name>
+  <description></description>
+  <version>1.0</version>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>org.apache.uima.fit.type.CompileType</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+    </typeDescription>
+  </types>
+</typeSystemDescription>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact-plus-test-scope/pom.xml b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact-plus-test-scope/pom.xml
new file mode 100644
index 0000000..5703b41
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact-plus-test-scope/pom.xml
@@ -0,0 +1,79 @@
+<?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.
+-->
+
+<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/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.uima.fit.maven.it</groupId>
+    <artifactId>default</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>main-artifact-plus-test-scope</artifactId>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.uima.fit.maven.it</groupId>
+      <artifactId>compile-artifact</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.uima.fit.maven.it</groupId>
+      <artifactId>test-artifact</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.uima</groupId>
+      <artifactId>uimafit-core</artifactId>
+      <version>@pom.version@</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.uima</groupId>
+        <artifactId>uimafit-maven-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <componentVendor>Apache UIMA</componentVendor>
+          <componentCopyright>Copyright by the respective authors.</componentCopyright>
+        </configuration>
+        <executions>
+          <execution>
+            <id>default</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>enhance</goal>
+              <goal>generate</goal>
+            </goals>
+            <configuration>
+              <includeScope>test</includeScope>
+              <addTypeSystemDescriptions>EMBEDDED</addTypeSystemDescriptions>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact-plus-test-scope/src/main/java/TestAnnotator.java b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact-plus-test-scope/src/main/java/TestAnnotator.java
new file mode 100644
index 0000000..65c612f
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact-plus-test-scope/src/main/java/TestAnnotator.java
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.fit.descriptor.ConfigurationParameter;
+import org.apache.uima.jcas.JCas;
+
+/**
+ * Test annotator.
+ */
+public class TestAnnotator extends JCasAnnotator_ImplBase {
+
+  @Override
+  public void process(JCas aJCas) throws AnalysisEngineProcessException {
+    // Nothing to do
+  }
+}
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact/pom.xml b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact/pom.xml
new file mode 100644
index 0000000..a245507
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact/pom.xml
@@ -0,0 +1,78 @@
+<?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.
+-->
+
+<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/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.uima.fit.maven.it</groupId>
+    <artifactId>default</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>main-artifact</artifactId>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.uima.fit.maven.it</groupId>
+      <artifactId>compile-artifact</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.uima.fit.maven.it</groupId>
+      <artifactId>test-artifact</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.uima</groupId>
+      <artifactId>uimafit-core</artifactId>
+      <version>@pom.version@</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.uima</groupId>
+        <artifactId>uimafit-maven-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <componentVendor>Apache UIMA</componentVendor>
+          <componentCopyright>Copyright by the respective authors.</componentCopyright>
+        </configuration>
+        <executions>
+          <execution>
+            <id>default</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>enhance</goal>
+              <goal>generate</goal>
+            </goals>
+            <configuration>
+              <addTypeSystemDescriptions>EMBEDDED</addTypeSystemDescriptions>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact/src/main/java/TestAnnotator.java b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact/src/main/java/TestAnnotator.java
new file mode 100644
index 0000000..65c612f
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/main-artifact/src/main/java/TestAnnotator.java
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.fit.descriptor.ConfigurationParameter;
+import org.apache.uima.jcas.JCas;
+
+/**
+ * Test annotator.
+ */
+public class TestAnnotator extends JCasAnnotator_ImplBase {
+
+  @Override
+  public void process(JCas aJCas) throws AnalysisEngineProcessException {
+    // Nothing to do
+  }
+}
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/pom.xml b/uimafit-maven-plugin/src/it/compile-test-scope/pom.xml
new file mode 100644
index 0000000..de83c45
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/pom.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+
+<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/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>org.apache.uima.fit.maven.it</groupId>
+	<artifactId>default</artifactId>
+	<version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+	<properties>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+  
+  <modules>
+    <module>test-artifact</module>
+    <module>compile-artifact</module>
+    <module>main-artifact</module>
+    <module>main-artifact-plus-test-scope</module>
+  </modules>
+</project>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/reference/main-artifact-plus-test-scope/TestAnnotator.xml b/uimafit-maven-plugin/src/it/compile-test-scope/reference/main-artifact-plus-test-scope/TestAnnotator.xml
new file mode 100644
index 0000000..d6e6c99
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/reference/main-artifact-plus-test-scope/TestAnnotator.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+        
+    <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+        
+    <primitive>true</primitive>
+        
+    <annotatorImplementationName>TestAnnotator</annotatorImplementationName>
+        
+    <analysisEngineMetaData>
+                
+        <name>TestAnnotator</name>
+                
+        <description>Test annotator.</description>
+                
+        <version>1.0-SNAPSHOT</version>
+                
+        <vendor>Apache UIMA</vendor>
+                
+        <copyright>Copyright by the respective authors.</copyright>
+                
+        <configurationParameters/>
+                
+        <configurationParameterSettings/>
+                
+        <typeSystemDescription>
+                        
+            <types>
+                                
+                <typeDescription>
+                                        
+                    <name>org.apache.uima.fit.type.CompileType</name>
+                                        
+                    <description/>
+                                        
+                    <supertypeName>uima.tcas.Annotation</supertypeName>
+                                    
+                </typeDescription>
+                                
+                <typeDescription>
+                                        
+                    <name>org.apache.uima.fit.type.TestType</name>
+                                        
+                    <description/>
+                                        
+                    <supertypeName>uima.tcas.Annotation</supertypeName>
+                                    
+                </typeDescription>
+                            
+            </types>
+                    
+        </typeSystemDescription>
+                
+        <typePriorities/>
+                
+        <fsIndexCollection/>
+                
+        <capabilities/>
+                
+        <operationalProperties>
+                        
+            <modifiesCas>true</modifiesCas>
+                        
+            <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+                        
+            <outputsNewCASes>false</outputsNewCASes>
+                    
+        </operationalProperties>
+            
+    </analysisEngineMetaData>
+    
+</analysisEngineDescription>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/reference/main-artifact/TestAnnotator.xml b/uimafit-maven-plugin/src/it/compile-test-scope/reference/main-artifact/TestAnnotator.xml
new file mode 100644
index 0000000..bf9478c
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/reference/main-artifact/TestAnnotator.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+        
+    <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+        
+    <primitive>true</primitive>
+        
+    <annotatorImplementationName>TestAnnotator</annotatorImplementationName>
+        
+    <analysisEngineMetaData>
+                
+        <name>TestAnnotator</name>
+                
+        <description>Test annotator.</description>
+                
+        <version>1.0-SNAPSHOT</version>
+                
+        <vendor>Apache UIMA</vendor>
+                
+        <copyright>Copyright by the respective authors.</copyright>
+                
+        <configurationParameters/>
+                
+        <configurationParameterSettings/>
+                
+        <typeSystemDescription>
+                        
+            <types>
+                                
+                <typeDescription>
+                                        
+                    <name>org.apache.uima.fit.type.CompileType</name>
+                                        
+                    <description/>
+                                        
+                    <supertypeName>uima.tcas.Annotation</supertypeName>
+                                    
+                </typeDescription>
+                            
+            </types>
+                    
+        </typeSystemDescription>
+                
+        <typePriorities/>
+                
+        <fsIndexCollection/>
+                
+        <capabilities/>
+                
+        <operationalProperties>
+                        
+            <modifiesCas>true</modifiesCas>
+                        
+            <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+                        
+            <outputsNewCASes>false</outputsNewCASes>
+                    
+        </operationalProperties>
+            
+    </analysisEngineMetaData>
+    
+</analysisEngineDescription>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/pom.xml b/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/pom.xml
new file mode 100644
index 0000000..85529a7
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/pom.xml
@@ -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.
+-->
+
+<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/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.uima.fit.maven.it</groupId>
+    <artifactId>default</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>test-artifact</artifactId>
+</project>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/src/main/resources/META-INF/org.apache.uima.fit/types.txt b/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/src/main/resources/META-INF/org.apache.uima.fit/types.txt
new file mode 100644
index 0000000..61797b7
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/src/main/resources/META-INF/org.apache.uima.fit/types.txt
@@ -0,0 +1 @@
+classpath*:org/apache/uima/fit/type/testartifact/types.xml
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/src/main/resources/org/apache/uima/fit/type/testartifact/types.xml b/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/src/main/resources/org/apache/uima/fit/type/testartifact/types.xml
new file mode 100644
index 0000000..3eb3fce
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/test-artifact/src/main/resources/org/apache/uima/fit/type/testartifact/types.xml
@@ -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>Test Types</name>
+  <description></description>
+  <version>1.0</version>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>org.apache.uima.fit.type.TestType</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+    </typeDescription>
+  </types>
+</typeSystemDescription>
diff --git a/uimafit-maven-plugin/src/it/compile-test-scope/verify.bsh b/uimafit-maven-plugin/src/it/compile-test-scope/verify.bsh
new file mode 100644
index 0000000..df87f6e
--- /dev/null
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/verify.bsh
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+import org.apache.commons.io.*;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
+
+try
+{
+  String reference = IOUtils.toString(new File(basedir, 
+    "reference/main-artifact/TestAnnotator.xml").toURI().toURL());
+  String actual = IOUtils.toString(new File(basedir, 
+    "main-artifact/target/classes/TestAnnotator.xml").toURI().toURL());
+
+  // In a local build, I get indented XML but on the Apache Jenkins I get non-indented XML. This
+  // settings tells XMLUnit to ignore this difference in whitespace - rec 2013-02-16
+  XMLUnit.setIgnoreWhitespace(true);
+  Diff diff = XMLUnit.compareXML(reference, actual);
+
+  if (!diff.identical()) {
+        System.out.println("Actual descriptor does not match expected descriptor: " + diff);
+        return false;
+  }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+try
+{
+  String reference = IOUtils.toString(new File(basedir, 
+    "reference/main-artifact-plus-test-scope/TestAnnotator.xml").toURI().toURL());
+  String actual = IOUtils.toString(new File(basedir, 
+    "main-artifact-plus-test-scope/target/classes/TestAnnotator.xml").toURI().toURL());
+
+  // In a local build, I get indented XML but on the Apache Jenkins I get non-indented XML. This
+  // settings tells XMLUnit to ignore this difference in whitespace - rec 2013-02-16
+  XMLUnit.setIgnoreWhitespace(true);
+  Diff diff = XMLUnit.compareXML(reference, actual);
+
+  if (!diff.identical()) {
+        System.out.println("Actual descriptor does not match expected descriptor: " + diff);
+        return false;
+  }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;
diff --git a/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java b/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java
index 8a4acaa..f00c28b 100644
--- a/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java
+++ b/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java
@@ -18,6 +18,8 @@
  */
 package org.apache.uima.fit.maven;
 
+import static org.apache.commons.lang.exception.ExceptionUtils.getRootCauseMessage;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -31,20 +33,6 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtField;
-import javassist.LoaderClassPath;
-import javassist.NotFoundException;
-import javassist.bytecode.AnnotationsAttribute;
-import javassist.bytecode.ClassFile;
-import javassist.bytecode.ConstPool;
-import javassist.bytecode.annotation.Annotation;
-import javassist.bytecode.annotation.MemberValue;
-import javassist.bytecode.annotation.StringMemberValue;
-
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.LineIterator;
 import org.apache.commons.lang.StringUtils;
@@ -71,6 +59,19 @@ import com.google.common.collect.LinkedHashMultimap;
 import com.google.common.collect.Multimap;
 import com.thoughtworks.qdox.model.JavaSource;
 
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtField;
+import javassist.LoaderClassPath;
+import javassist.NotFoundException;
+import javassist.bytecode.AnnotationsAttribute;
+import javassist.bytecode.ClassFile;
+import javassist.bytecode.ConstPool;
+import javassist.bytecode.annotation.Annotation;
+import javassist.bytecode.annotation.MemberValue;
+import javassist.bytecode.annotation.StringMemberValue;
+
 /**
  * Enhance UIMA components with automatically generated uimaFIT annotations.
  */
@@ -165,6 +166,13 @@ public class EnhanceMojo extends AbstractMojo {
   private String[] externalResourceNameConstantPrefixes = { "KEY_", "RES_" };
 
   /**
+   * Scope threshold to include. The default is "compile" (which implies compile, provided and
+   * system dependencies). Can also be changed to "test" (which implies all dependencies).
+   */
+  @Parameter(defaultValue = "compile", required = true)
+  private String includeScope;
+
+  /**
    * Start of a line containing a class name in the missing meta data report file
    */
   private static final String MARK_CLASS = "Class:";
@@ -174,12 +182,13 @@ public class EnhanceMojo extends AbstractMojo {
    */
   private static final String MARK_NO_MISSING_META_DATA = "No missing meta data was found.";
 
+  
+  @Override
   public void execute() throws MojoExecutionException, MojoFailureException {
     // Get the compiled classes from this project
     String[] files = FileUtils.getFilesFromExtension(project.getBuild().getOutputDirectory(),
             new String[] { "class" });
-
-    componentLoader = Util.getClassloader(project, getLog());
+    componentLoader = Util.getClassloader(project, getLog(), includeScope);
 
     // Set up class pool with all the project dependencies and the project classes themselves
     ClassPool classPool = new ClassPool(true);
@@ -242,7 +251,7 @@ public class EnhanceMojo extends AbstractMojo {
         ctClazz = classPool.get(clazzName);
       } catch (NotFoundException e) {
         throw new MojoExecutionException("Class [" + clazzName + "] not found in class pool: "
-                + ExceptionUtils.getRootCauseMessage(e), e);
+                + getRootCauseMessage(e), e);
       }
 
       // Get the source file
@@ -280,10 +289,10 @@ public class EnhanceMojo extends AbstractMojo {
         }
       } catch (IOException e) {
         throw new MojoExecutionException("Enhanced class [" + clazzName + "] cannot be written: "
-                + ExceptionUtils.getRootCauseMessage(e), e);
+                + getRootCauseMessage(e), e);
       } catch (CannotCompileException e) {
         throw new MojoExecutionException("Enhanced class [" + clazzName + "] cannot be compiled: "
-                + ExceptionUtils.getRootCauseMessage(e), e);
+                + getRootCauseMessage(e), e);
       }
     }
     
diff --git a/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/GenerateDescriptorsMojo.java b/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/GenerateDescriptorsMojo.java
index 2e85b4b..cabb608 100644
--- a/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/GenerateDescriptorsMojo.java
+++ b/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/GenerateDescriptorsMojo.java
@@ -18,6 +18,9 @@
  */
 package org.apache.uima.fit.maven;
 
+import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngineDescription;
+import static org.apache.uima.fit.factory.CollectionReaderFactory.createReaderDescription;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -36,8 +39,6 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.collection.CollectionReaderDescription;
-import org.apache.uima.fit.factory.AnalysisEngineFactory;
-import org.apache.uima.fit.factory.CollectionReaderFactory;
 import org.apache.uima.fit.factory.TypeSystemDescriptionFactory;
 import org.apache.uima.fit.maven.util.Util;
 import org.apache.uima.resource.ResourceCreationSpecifier;
@@ -97,6 +98,13 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
   @Parameter(defaultValue = "NONE")
   private TypeSystemSerialization addTypeSystemDescriptions;
 
+  /**
+   * Scope threshold to include. The default is "compile" (which implies compile, provided and
+   * system dependencies). Can also be changed to "test" (which implies all dependencies).
+   */
+  @Parameter(defaultValue = "compile", required = true)
+  private String includeScope;
+
   @Override
   public void execute() throws MojoExecutionException {
     // add the generated sources to the build
@@ -109,7 +117,7 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
     String[] files = FileUtils.getFilesFromExtension(project.getBuild().getOutputDirectory(),
             new String[] { "class" });
 
-    componentLoader = Util.getClassloader(project, getLog());
+    componentLoader = Util.getClassloader(project, getLog(), includeScope);
 
     // List of components that is later written to META-INF/org.apache.uima.fit/components.txt
     StringBuilder componentsManifest = new StringBuilder();
@@ -136,13 +144,12 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
         ProcessingResourceMetaData metadata = null;
         switch (Util.getType(componentLoader, clazz)) {
           case ANALYSIS_ENGINE:
-            AnalysisEngineDescription aeDesc = AnalysisEngineFactory.createEngineDescription(clazz);
+            AnalysisEngineDescription aeDesc = createEngineDescription(clazz);
             metadata = aeDesc.getAnalysisEngineMetaData();
             desc = aeDesc;
             break;
           case COLLECTION_READER:
-            CollectionReaderDescription crDesc = CollectionReaderFactory
-                    .createReaderDescription(clazz);
+            CollectionReaderDescription crDesc = createReaderDescription(clazz);
             metadata = crDesc.getCollectionReaderMetaData();
             desc = crDesc;
           default:
diff --git a/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/util/Util.java b/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/util/Util.java
index 195817c..056dc8f 100644
--- a/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/util/Util.java
+++ b/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/util/Util.java
@@ -18,13 +18,19 @@
  */
 package org.apache.uima.fit.maven.util;
 
+import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableSet;
+
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.lang.exception.ExceptionUtils;
@@ -41,6 +47,16 @@ import com.thoughtworks.qdox.model.JavaSource;
 
 public final class Util {
 
+  private static final Map<String, Set<String>> SCOPES; 
+  static {
+    SCOPES = new HashMap<>();
+    SCOPES.put("test", unmodifiableSet(new HashSet<>(asList("provided", "compile", "system", "runtime", "test"))));
+    SCOPES.put("runtime", unmodifiableSet(new HashSet<>(asList("provided", "compile", "system", "runtime"))));
+    SCOPES.put("compile", unmodifiableSet(new HashSet<>(asList("provided", "compile", "system"))));
+    SCOPES.put("provided", unmodifiableSet(new HashSet<>(asList("provided"))));
+    SCOPES.put("system", unmodifiableSet(new HashSet<>(asList("system"))));
+  }
+
   private Util() {
     // No instances
   }
@@ -123,7 +139,7 @@ public final class Util {
    * Create a class loader which covers the classes compiled in the current project and all
    * dependencies.
    */
-  public static URLClassLoader getClassloader(MavenProject aProject, Log aLog)
+  public static URLClassLoader getClassloader(MavenProject aProject, Log aLog, String aIncludeScopeThreshold)
           throws MojoExecutionException {
     List<URL> urls = new ArrayList<URL>();
     try {
@@ -139,13 +155,28 @@ public final class Util {
       throw new MojoExecutionException("Unable to resolve dependencies: "
               + ExceptionUtils.getRootCauseMessage(e), e);
     }
-
+    
+    Set<String> scopes = SCOPES.get(aIncludeScopeThreshold);
+    if (scopes == null) {
+      throw new MojoExecutionException("Unsupported scope: " + aIncludeScopeThreshold);
+    }
+    
     for (Artifact dep : (Set<Artifact>) aProject.getDependencyArtifacts()) {
       try {
+        if (!scopes.contains(dep.getScope())) {
+          aLog.debug("Not generating classpath entry for out-of-scope artifact: " + dep.getGroupId()
+                  + ":" + dep.getArtifactId() + ":" + dep.getVersion() + "(" + dep.getScope()
+                  + ")");
+          continue;
+        }
+        
         if (dep.getFile() == null) {
+          aLog.debug("Not generating classpath entry for unresolved artifact: " + dep.getGroupId()
+                  + ":" + dep.getArtifactId() + ":" + dep.getVersion());
           // Unresolved file because it is in the wrong scope (e.g. test?)
           continue;
         }
+                
         aLog.debug("Classpath entry: " + dep.getGroupId() + ":" + dep.getArtifactId() + ":"
                 + dep.getVersion() + " -> " + dep.getFile());
         urls.add(dep.getFile().toURI().toURL());