All packages up to the root are checked for annotations
authorKai Moritz <kai@juplo.de>
Sun, 20 Dec 2015 20:06:37 +0000 (21:06 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 7 Mar 2016 13:20:10 +0000 (14:20 +0100)
src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java

index 1eb54e5..f6e18ea 100644 (file)
@@ -1081,8 +1081,10 @@ public abstract class AbstractSchemaMojo extends AbstractMojo
         packageName = name;
       }
 
-      if (!packages.contains(packageName))
+      while (packageName != null)
       {
+        if (packages.contains(packageName))
+          return;
         String resource = packageName.replace('.', '/') + "/package-info.class";
         InputStream is = classLoaderService.locateResourceStream(resource);
         if (is == null)
@@ -1100,6 +1102,11 @@ public abstract class AbstractSchemaMojo extends AbstractMojo
           sources.addPackage(packageName);
         }
         packages.add(packageName);
+        int i = packageName.lastIndexOf('.');
+        if (i < 0)
+          packageName = null;
+        else
+          packageName = packageName.substring(0,i);
       }
     }
     catch (Exception e)