All packages up to the root are checked for annotations
[hibernate4-maven-plugin] / src / main / java / de / juplo / plugins / hibernate / AbstractSchemaMojo.java
index 2295968..f6e18ea 100644 (file)
@@ -641,6 +641,21 @@ public abstract class AbstractSchemaMojo extends AbstractMojo
         thread.setContextClassLoader(contextClassLoader);
       }
     }
+    catch (MojoExecutionException e)
+    {
+      tracker.failed();
+      throw e;
+    }
+    catch (MojoFailureException e)
+    {
+      tracker.failed();
+      throw e;
+    }
+    catch (RuntimeException e)
+    {
+      tracker.failed();
+      throw e;
+    }
     finally
     {
       /** Remember mappings and configuration */
@@ -1066,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)
@@ -1085,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)