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 2022/05/13 16:23:25 UTC
[uima-uimafit] 01/01: [UIMA-6432] Upgrade dependencies (uimaFIT 3.3.0)
This is an automated email from the ASF dual-hosted git repository.
rec pushed a commit to branch refactoring/UIMA-6432-Upgrade-dependencies
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git
commit 36073455d1f74700770d0d1a9fd9927135726b63
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Fri May 13 18:23:18 2022 +0200
[UIMA-6432] Upgrade dependencies (uimaFIT 3.3.0)
- Apache UIMA Parent POM 14 -> 15-SNAPSHOT
- Fix warnings due to upgraded Maven plugins
- Upgrade Maven Plugin Tests also to the XMLUnit used by the main code and fix them
---
uimafit-maven-plugin/pom.xml | 18 ++--
.../TestAnnotator.xml | 118 +++++++--------------
.../reference/main-artifact/TestAnnotator.xml | 91 ++++++----------
.../src/it/compile-test-scope/verify.bsh | 53 +++------
uimafit-maven-plugin/src/it/default/verify.bsh | 33 ++----
.../it/with-typesystem-in-descriptors/verify.bsh | 33 ++----
.../org/apache/uima/fit/maven/EnhanceMojo.java | 83 +++++++--------
.../uima/fit/maven/GenerateDescriptorsMojo.java | 58 +++++-----
uimafit-parent/pom.xml | 2 +-
uimafit-spring/pom.xml | 1 +
10 files changed, 181 insertions(+), 309 deletions(-)
diff --git a/uimafit-maven-plugin/pom.xml b/uimafit-maven-plugin/pom.xml
index 38ad7d4..1537716 100644
--- a/uimafit-maven-plugin/pom.xml
+++ b/uimafit-maven-plugin/pom.xml
@@ -71,21 +71,25 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
@@ -115,14 +119,6 @@
<artifactId>guava</artifactId>
<version>11.0.1</version>
</dependency>
-
- <!--
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
- </dependency>
- -->
</dependencies>
<build>
@@ -157,12 +153,12 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.7</version>
+ <version>${commons-io-version}</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
- <artifactId>xmlunit-assertj</artifactId>
- <version>2.6.4</version>
+ <artifactId>xmlunit-assertj3</artifactId>
+ <version>${xmlunit-version}</version>
</dependency>
</dependencies>
</plugin>
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
index bd3a6b6..7e546b1 100644
--- 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
@@ -18,83 +18,43 @@
~ under the License.
-->
<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>
-
- <typeDescription>
-
- <name>org.apache.uima.fit.type.TestType2</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>
-
+ <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>
+ <typeDescription>
+ <name>org.apache.uima.fit.type.TestType2</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
index 3fadbc9..845472a 100644
--- 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
@@ -17,64 +17,35 @@
~ specific language governing permissions and limitations
~ under the License.
-->
-<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
+ 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/verify.bsh b/uimafit-maven-plugin/src/it/compile-test-scope/verify.bsh
index df87f6e..1967a24 100644
--- a/uimafit-maven-plugin/src/it/compile-test-scope/verify.bsh
+++ b/uimafit-maven-plugin/src/it/compile-test-scope/verify.bsh
@@ -19,55 +19,28 @@
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;
+import org.xmlunit.assertj3.XmlAssert;
-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());
-
+ File reference = new File(basedir, "reference/main-artifact/TestAnnotator.xml");
+ File actual = new File(basedir, "main-artifact/target/classes/TestAnnotator.xml");
+
// 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;
+ System.out.println("Comparing expected ["+reference+"] vs actual ["+actual+"]");
+ XmlAssert.assertThat(actual).and(reference)
+ .ignoreComments().normalizeWhitespace().areIdentical();
}
-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());
-
+ File reference = new File(basedir, "reference/main-artifact-plus-test-scope/TestAnnotator.xml");
+ File actual = new File(basedir, "main-artifact-plus-test-scope/target/classes/TestAnnotator.xml");
+
// 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;
+ System.out.println("Comparing expected ["+reference+"] vs actual ["+actual+"]");
+ XmlAssert.assertThat(actual).and(reference)
+ .ignoreComments().normalizeWhitespace().areIdentical();
}
return true;
diff --git a/uimafit-maven-plugin/src/it/default/verify.bsh b/uimafit-maven-plugin/src/it/default/verify.bsh
index 34d0f2f..57d81b4 100644
--- a/uimafit-maven-plugin/src/it/default/verify.bsh
+++ b/uimafit-maven-plugin/src/it/default/verify.bsh
@@ -19,32 +19,17 @@
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;
+import org.xmlunit.assertj3.XmlAssert;
-try
{
- String reference = IOUtils.toString(new File(basedir,
- "reference/TestAnnotator.xml").toURI().toURL());
- String actual = IOUtils.toString(new File(basedir,
- "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;
+ File reference = new File(basedir, "reference/TestAnnotator.xml");
+ File actual = new File(basedir, "target/classes/TestAnnotator.xml");
+
+ // 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
+ System.out.println("Comparing expected ["+reference+"] vs actual ["+actual+"]");
+ XmlAssert.assertThat(actual).and(reference)
+ .ignoreComments().normalizeWhitespace().areIdentical();
}
return true;
diff --git a/uimafit-maven-plugin/src/it/with-typesystem-in-descriptors/verify.bsh b/uimafit-maven-plugin/src/it/with-typesystem-in-descriptors/verify.bsh
index 34d0f2f..57d81b4 100644
--- a/uimafit-maven-plugin/src/it/with-typesystem-in-descriptors/verify.bsh
+++ b/uimafit-maven-plugin/src/it/with-typesystem-in-descriptors/verify.bsh
@@ -19,32 +19,17 @@
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;
+import org.xmlunit.assertj3.XmlAssert;
-try
{
- String reference = IOUtils.toString(new File(basedir,
- "reference/TestAnnotator.xml").toURI().toURL());
- String actual = IOUtils.toString(new File(basedir,
- "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;
+ File reference = new File(basedir, "reference/TestAnnotator.xml");
+ File actual = new File(basedir, "target/classes/TestAnnotator.xml");
+
+ // 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
+ System.out.println("Comparing expected ["+reference+"] vs actual ["+actual+"]");
+ XmlAssert.assertThat(actual).and(reference)
+ .ignoreComments().normalizeWhitespace().areIdentical();
}
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 91eb22c..09b0dc9 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
@@ -78,7 +78,7 @@ import javassist.bytecode.annotation.StringMemberValue;
*/
@Mojo(name = "enhance", defaultPhase = PROCESS_CLASSES, requiresDependencyResolution = TEST, requiresDependencyCollection = TEST)
public class EnhanceMojo extends AbstractMojo {
- @Component
+ @Parameter(defaultValue = "${project}", readonly = true)
private MavenProject project;
@Component
@@ -187,7 +187,7 @@ public class EnhanceMojo extends AbstractMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
// Get the compiled classes from this project
String[] files = FileUtils.getFilesFromExtension(project.getBuild().getOutputDirectory(),
- new String[] { "class" });
+ new String[] { "class" });
componentLoader = Util.getClassloader(project, getLog(), includeScope);
// Set up class pool with all the project dependencies and the project classes themselves
@@ -199,7 +199,7 @@ public class EnhanceMojo extends AbstractMojo {
// Determine where to write the missing meta data report file
File reportFile = new File(project.getBuild().getDirectory(),
- "uimafit-missing-meta-data-report.txt");
+ "uimafit-missing-meta-data-report.txt");
// Read existing report
if (generateMissingMetaDataReport) {
@@ -251,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: " + getRootCauseMessage(e), e);
+ "Class [" + clazzName + "] not found in class pool: " + getRootCauseMessage(e), e);
}
// Get the source file
@@ -289,17 +289,15 @@ public class EnhanceMojo extends AbstractMojo {
}
} catch (IOException e) {
throw new MojoExecutionException(
- "Enhanced class [" + clazzName + "] cannot be written: " + getRootCauseMessage(e),
- e);
+ "Enhanced class [" + clazzName + "] cannot be written: " + getRootCauseMessage(e), e);
} catch (CannotCompileException e) {
throw new MojoExecutionException(
- "Enhanced class [" + clazzName + "] cannot be compiled: " + getRootCauseMessage(e),
- e);
+ "Enhanced class [" + clazzName + "] cannot be compiled: " + getRootCauseMessage(e), e);
}
}
getLog().info("Enhanced " + countEnhanced + " class" + (countEnhanced != 1 ? "es" : "") + " ("
- + countAlreadyEnhanced + " already enhanced).");
+ + countAlreadyEnhanced + " already enhanced).");
if (generateMissingMetaDataReport) {
// Remove any classes from the report that are no longer part of the build
@@ -312,7 +310,7 @@ public class EnhanceMojo extends AbstractMojo {
if (failOnMissingMetaData && !reportData.isEmpty()) {
throw new MojoFailureException("Component meta data missing. A report of the missing "
- + "meta data can be found in " + reportFile);
+ + "meta data can be found in " + reportFile);
}
}
}
@@ -325,7 +323,7 @@ public class EnhanceMojo extends AbstractMojo {
ConstPool constPool = classFile.getConstPool();
AnnotationsAttribute annoAttr = (AnnotationsAttribute) classFile
- .getAttribute(AnnotationsAttribute.visibleTag);
+ .getAttribute(AnnotationsAttribute.visibleTag);
// Create annotation attribute if it does not exist
if (annoAttr == null) {
@@ -346,12 +344,12 @@ public class EnhanceMojo extends AbstractMojo {
* Enhance resource meta data
*/
private void enhanceResourceMetaData(JavaSource aAST, Class<?> aClazz, CtClass aCtClazz,
- Multimap<String, String> aReportData) {
+ Multimap<String, String> aReportData) {
ClassFile classFile = aCtClazz.getClassFile();
ConstPool constPool = classFile.getConstPool();
AnnotationsAttribute annoAttr = (AnnotationsAttribute) classFile
- .getAttribute(AnnotationsAttribute.visibleTag);
+ .getAttribute(AnnotationsAttribute.visibleTag);
// Create annotation attribute if it does not exist
if (annoAttr == null) {
@@ -364,25 +362,25 @@ public class EnhanceMojo extends AbstractMojo {
a = new Annotation(ResourceMetaData.class.getName(), constPool);
// Add a name, otherwise there will be none in the generated descriptor.
a.addMemberValue("name",
- new StringMemberValue(ResourceMetaDataFactory.getDefaultName(aClazz), constPool));
+ new StringMemberValue(ResourceMetaDataFactory.getDefaultName(aClazz), constPool));
}
// Update description from JavaDoc
String doc = Util.getComponentDocumentation(aAST, aClazz.getName());
enhanceMemberValue(a, "description", doc, overrideComponentDescription,
- ResourceMetaDataFactory.getDefaultDescription(aClazz), constPool, aReportData, aClazz);
+ ResourceMetaDataFactory.getDefaultDescription(aClazz), constPool, aReportData, aClazz);
// Update version
enhanceMemberValue(a, "version", componentVersion, overrideComponentVersion,
- ResourceMetaDataFactory.getDefaultVersion(aClazz), constPool, aReportData, aClazz);
+ ResourceMetaDataFactory.getDefaultVersion(aClazz), constPool, aReportData, aClazz);
// Update vendor
enhanceMemberValue(a, "vendor", componentVendor, overrideComponentVendor,
- ResourceMetaDataFactory.getDefaultVendor(aClazz), constPool, aReportData, aClazz);
+ ResourceMetaDataFactory.getDefaultVendor(aClazz), constPool, aReportData, aClazz);
// Update copyright
enhanceMemberValue(a, "copyright", componentCopyright, overrideComponentCopyright,
- ResourceMetaDataFactory.getDefaultCopyright(aClazz), constPool, aReportData, aClazz);
+ ResourceMetaDataFactory.getDefaultCopyright(aClazz), constPool, aReportData, aClazz);
// Replace annotation
annoAttr.addAnnotation(a);
@@ -404,11 +402,12 @@ public class EnhanceMojo extends AbstractMojo {
* @param aOverride
* set value even if it is already set
* @param aDefault
- * default value set by uimaFIT - if the member has this value, it is considered unset
+ * default value set by uimaFIT - if the member has this value, it is considered
+ * unset
*/
private void enhanceMemberValue(Annotation aAnnotation, String aName, String aNewValue,
- boolean aOverride, String aDefault, ConstPool aConstPool,
- Multimap<String, String> aReportData, Class<?> aClazz) {
+ boolean aOverride, String aDefault, ConstPool aConstPool,
+ Multimap<String, String> aReportData, Class<?> aClazz) {
String value = getStringMemberValue(aAnnotation, aName);
boolean isEmpty = value.length() == 0;
boolean isDefault = value.equals(aDefault);
@@ -439,12 +438,12 @@ public class EnhanceMojo extends AbstractMojo {
* Enhance descriptions in configuration parameters.
*/
private void enhanceConfigurationParameter(JavaSource aAST, Class<?> aClazz, CtClass aCtClazz,
- Multimap<String, String> aReportData) throws MojoExecutionException {
+ Multimap<String, String> aReportData) throws MojoExecutionException {
// Get the parameter name constants
Map<String, String> parameterNameFields = getParameterConstants(aClazz,
- parameterNameConstantPrefixes);
+ parameterNameConstantPrefixes);
Map<String, String> resourceNameFields = getParameterConstants(aClazz,
- externalResourceNameConstantPrefixes);
+ externalResourceNameConstantPrefixes);
// Fetch configuration parameters from the @ConfigurationParameter annotations in the
// compiled class. We only need the fields in the class itself. Superclasses should be
@@ -461,7 +460,7 @@ public class EnhanceMojo extends AbstractMojo {
pname = ConfigurationParameterFactory.createPrimitiveParameter(field).getName();
// Extract JavaDoc for this resource from the source file
pdesc = Util.getParameterDocumentation(aAST, field.getName(),
- parameterNameFields.get(pname));
+ parameterNameFields.get(pname));
}
// Is this an external resource?
@@ -471,7 +470,7 @@ public class EnhanceMojo extends AbstractMojo {
pname = ExternalResourceFactory.createResourceDependency(field).getKey();
// Extract JavaDoc for this resource from the source file
pdesc = Util.getParameterDocumentation(aAST, field.getName(),
- resourceNameFields.get(pname));
+ resourceNameFields.get(pname));
} else {
continue;
}
@@ -487,7 +486,7 @@ public class EnhanceMojo extends AbstractMojo {
try {
CtField ctField = aCtClazz.getField(field.getName());
AnnotationsAttribute annoAttr = (AnnotationsAttribute) ctField.getFieldInfo()
- .getAttribute(AnnotationsAttribute.visibleTag);
+ .getAttribute(AnnotationsAttribute.visibleTag);
// Locate and update annotation
if (annoAttr != null) {
@@ -496,19 +495,20 @@ public class EnhanceMojo extends AbstractMojo {
// Update existing annotation
for (Annotation a : annotations) {
if (a.getTypeName()
- .equals(org.apache.uima.fit.descriptor.ConfigurationParameter.class.getName())
- || a.getTypeName()
- .equals(org.apache.uima.fit.descriptor.ExternalResource.class.getName())
- || a.getTypeName().equals("org.uimafit.descriptor.ConfigurationParameter")
- || a.getTypeName().equals("org.uimafit.descriptor.ExternalResource")) {
+ .equals(org.apache.uima.fit.descriptor.ConfigurationParameter.class.getName())
+ || a.getTypeName()
+ .equals(org.apache.uima.fit.descriptor.ExternalResource.class.getName())
+ || a.getTypeName().equals("org.uimafit.descriptor.ConfigurationParameter")
+ || a.getTypeName().equals("org.uimafit.descriptor.ExternalResource")) {
if (a.getMemberValue("description") == null) {
a.addMemberValue("description",
- new StringMemberValue(pdesc, aCtClazz.getClassFile().getConstPool()));
+ new StringMemberValue(pdesc, aCtClazz.getClassFile().getConstPool()));
getLog().debug("Enhanced description of " + type + " [" + pname + "]");
// Replace updated annotation
annoAttr.addAnnotation(a);
} else {
- // Extract configuration parameter information from the uimaFIT annotation
+ // Extract configuration parameter information from the uimaFIT
+ // annotation
// We only want to override if the description is not set yet.
getLog().debug("Not overwriting description of " + type + " [" + pname + "] ");
}
@@ -520,7 +520,7 @@ public class EnhanceMojo extends AbstractMojo {
ctField.getFieldInfo().addAttribute(annoAttr);
} catch (NotFoundException e) {
throw new MojoExecutionException("Field [" + field.getName() + "] not found in byte code: "
- + ExceptionUtils.getRootCauseMessage(e), e);
+ + ExceptionUtils.getRootCauseMessage(e), e);
}
}
}
@@ -552,7 +552,7 @@ public class EnhanceMojo extends AbstractMojo {
result.put(parameterName, f.getName());
} catch (IllegalAccessException e) {
getLog().warn("Unable to access name constant field [" + f.getName() + "]: "
- + ExceptionUtils.getRootCauseMessage(e), e);
+ + ExceptionUtils.getRootCauseMessage(e), e);
}
}
return result;
@@ -563,7 +563,7 @@ public class EnhanceMojo extends AbstractMojo {
return Util.parseSource(aSourceFile, encoding);
} catch (IOException e) {
throw new MojoExecutionException("Unable to parse source file [" + aSourceFile + "]: "
- + ExceptionUtils.getRootCauseMessage(e), e);
+ + ExceptionUtils.getRootCauseMessage(e), e);
}
}
@@ -589,7 +589,7 @@ public class EnhanceMojo extends AbstractMojo {
* Write a report on any meta data missing from components.
*/
private void writeMissingMetaDataReport(File aReportFile, Multimap<String, String> aReportData)
- throws MojoExecutionException {
+ throws MojoExecutionException {
String[] classes = aReportData.keySet().toArray(new String[aReportData.keySet().size()]);
Arrays.sort(classes);
@@ -616,7 +616,7 @@ public class EnhanceMojo extends AbstractMojo {
}
} catch (IOException e) {
throw new MojoExecutionException("Unable to write missing meta data report to [" + aReportFile
- + "]" + ExceptionUtils.getRootCauseMessage(e), e);
+ + "]" + ExceptionUtils.getRootCauseMessage(e), e);
} finally {
IOUtils.closeQuietly(out);
}
@@ -626,7 +626,7 @@ public class EnhanceMojo extends AbstractMojo {
* Read the missing meta data report from a previous run.
*/
private void readMissingMetaDataReport(File aReportFile, Multimap<String, String> aReportData)
- throws MojoExecutionException {
+ throws MojoExecutionException {
if (!aReportFile.exists()) {
// Ignore if the file is missing
return;
@@ -657,8 +657,7 @@ public class EnhanceMojo extends AbstractMojo {
}
} catch (IOException e) {
throw new MojoExecutionException(
- "Unable to read missing meta data report: " + ExceptionUtils.getRootCauseMessage(e),
- e);
+ "Unable to read missing meta data report: " + ExceptionUtils.getRootCauseMessage(e), e);
} finally {
LineIterator.closeQuietly(i);
}
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 89efbf9..48460a6 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
@@ -58,7 +58,7 @@ import org.xml.sax.SAXException;
*/
@Mojo(name = "generate", defaultPhase = PROCESS_CLASSES, requiresDependencyResolution = TEST, requiresDependencyCollection = TEST)
public class GenerateDescriptorsMojo extends AbstractMojo {
- @Component
+ @Parameter(defaultValue = "${project}", readonly = true)
private MavenProject project;
@Component
@@ -124,7 +124,7 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
// Get the compiled classes from this project
String[] files = FileUtils.getFilesFromExtension(project.getBuild().getOutputDirectory(),
- new String[] { "class" });
+ new String[] { "class" });
componentLoader = Util.getClassloader(project, getLog(), includeScope);
@@ -152,27 +152,27 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
ResourceCreationSpecifier desc = null;
ProcessingResourceMetaData metadata = null;
switch (Util.getType(componentLoader, clazz)) {
- case ANALYSIS_ENGINE:
- AnalysisEngineDescription aeDesc = createEngineDescription(clazz);
- metadata = aeDesc.getAnalysisEngineMetaData();
- desc = aeDesc;
- break;
- case COLLECTION_READER:
- CollectionReaderDescription crDesc = createReaderDescription(clazz);
- metadata = crDesc.getCollectionReaderMetaData();
- desc = crDesc;
- default:
- // Do nothing
+ case ANALYSIS_ENGINE:
+ AnalysisEngineDescription aeDesc = createEngineDescription(clazz);
+ metadata = aeDesc.getAnalysisEngineMetaData();
+ desc = aeDesc;
+ break;
+ case COLLECTION_READER:
+ CollectionReaderDescription crDesc = createReaderDescription(clazz);
+ metadata = crDesc.getCollectionReaderMetaData();
+ desc = crDesc;
+ default:
+ // Do nothing
}
if (desc != null) {
switch (addTypeSystemDescriptions) {
- case EMBEDDED:
- embedTypeSystems(metadata);
- break;
- case NONE: // fall-through
- default:
- // Do nothing
+ case EMBEDDED:
+ embedTypeSystems(metadata);
+ break;
+ case NONE: // fall-through
+ default:
+ // Do nothing
}
File out = new File(outputDirectory, clazzPath + ".xml");
@@ -196,8 +196,8 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
}
}
- getLog().info(
- "Generated " + countGenerated + " descriptor" + (countGenerated != 1 ? "s." : "."));
+ getLog()
+ .info("Generated " + countGenerated + " descriptor" + (countGenerated != 1 ? "s." : "."));
// Write META-INF/org.apache.uima.fit/components.txt unless skipped and unless there are no
// components
@@ -208,23 +208,25 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
FileUtils.fileWrite(path.getPath(), encoding, componentsManifest.toString());
} catch (IOException e) {
handleError("Cannot write components manifest to [" + path + "]"
- + ExceptionUtils.getRootCauseMessage(e), e);
+ + ExceptionUtils.getRootCauseMessage(e), e);
}
}
if (addOutputDirectoryAsResourceDirectory && countGenerated > 0) {
Path absoluteDescriptorOutputPath = outputDirectory.toPath().toAbsolutePath();
Path absoluteBuildOutputDirectory = Paths.get(project.getBuild().getOutputDirectory())
- .toAbsolutePath();
+ .toAbsolutePath();
Path absoluteBuildTestOutputDirectory = Paths.get(project.getBuild().getTestOutputDirectory())
- .toAbsolutePath();
+ .toAbsolutePath();
- // Add the output folder as a new resource folder if any descriptors were generated and only
- // if the descriptors were generated directly into the build output folder. The latter can
+ // Add the output folder as a new resource folder if any descriptors were generated and
+ // only
+ // if the descriptors were generated directly into the build output folder. The latter
+ // can
// be the case if the mojo is executed in a late build phase where the resources plugin
// doesn't run anymore.
if (!absoluteBuildOutputDirectory.equals(absoluteDescriptorOutputPath)
- && !absoluteBuildTestOutputDirectory.equals(absoluteDescriptorOutputPath)) {
+ && !absoluteBuildTestOutputDirectory.equals(absoluteDescriptorOutputPath)) {
Resource resource = new Resource();
resource.setDirectory(outputDirectory.getPath());
resource.setFiltering(false);
@@ -243,7 +245,7 @@ public class GenerateDescriptorsMojo extends AbstractMojo {
}
private void embedTypeSystems(ProcessingResourceMetaData metadata)
- throws ResourceInitializationException {
+ throws ResourceInitializationException {
TypeSystemDescriptionFactory.forceTypeDescriptorsScan();
TypeSystemDescription tsDesc = TypeSystemDescriptionFactory.createTypeSystemDescription();
metadata.setTypeSystem(tsDesc);
diff --git a/uimafit-parent/pom.xml b/uimafit-parent/pom.xml
index 94195f4..f8c3237 100644
--- a/uimafit-parent/pom.xml
+++ b/uimafit-parent/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.apache.uima</groupId>
<artifactId>parent-pom</artifactId>
<relativePath />
- <version>14</version>
+ <version>15-SNAPSHOT</version>
</parent>
<artifactId>uimafit-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
diff --git a/uimafit-spring/pom.xml b/uimafit-spring/pom.xml
index ea59782..d28aeac 100644
--- a/uimafit-spring/pom.xml
+++ b/uimafit-spring/pom.xml
@@ -56,6 +56,7 @@
<groupId>org.apache.uima</groupId>
<artifactId>uimafit-core</artifactId>
<version>3.3.0-SNAPSHOT</version>
+ <scope>test</scope>
</dependency>
</dependencies>
</project>