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 2013/01/28 04:20:37 UTC

svn commit: r1439237 - /uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java

Author: rec
Date: Mon Jan 28 03:20:36 2013
New Revision: 1439237

URL: http://svn.apache.org/viewvc?rev=1439237&view=rev
Log:
[UIMA-2600] Fill vendor, version, etc. from Maven project 
- Fixed bug that component metadata was only set if component JavaDoc was available

Modified:
    uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java

Modified: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java?rev=1439237&r1=1439236&r2=1439237&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java Mon Jan 28 03:20:36 2013
@@ -245,13 +245,6 @@ public class EnhanceMojo extends Abstrac
    */
   private void enhanceResourceMetaData(CompilationUnit aAST, Class aClazz, CtClass aCtClazz)
           throws MojoExecutionException {
-    String doc = getComponnetDocumentation(aAST, aClazz);
-
-    if (doc == null) {
-      getLog().warn("No description found for component [" + aClazz.getName() + "]");
-      return;
-    }
-
     ClassFile classFile = aCtClazz.getClassFile();
     ConstPool constPool = classFile.getConstPool();
 
@@ -267,9 +260,13 @@ public class EnhanceMojo extends Abstrac
     Annotation a = annoAttr.getAnnotation(ResourceMetaData.class.getName());
     if (a == null) {
       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));
     }
 
     // Update description from JavaDoc
+    String doc = getComponnetDocumentation(aAST, aClazz);
     enhanceMemberValue(a, "description", doc, overrideComponentDescription,
             ResourceMetaDataFactory.getDefaultDescription(aClazz), constPool);
 
@@ -313,9 +310,14 @@ public class EnhanceMojo extends Abstrac
     boolean isEmpty = value.length() == 0;
     boolean isDefault = value.equals(aDefault);
 
-    if ((aNewValue != null) && (isEmpty || isDefault || aOverride)) {
-      aAnnotation.addMemberValue(aName, new StringMemberValue(aNewValue, aConstPool));
-      getLog().info("Enhanced component meta data [" + aName + "]");
+    if (isEmpty || isDefault || aOverride) {
+      if (aNewValue != null) {
+        aAnnotation.addMemberValue(aName, new StringMemberValue(aNewValue, aConstPool));
+        getLog().info("Enhanced component meta data [" + aName + "]");
+      }
+      else {
+        getLog().warn("No meta data [" + aName + "] found");
+      }
     } else {
       getLog().info("Not overwriting component meta data [" + aName + "]");
     }