// Clear unused system-properties
config.setProperties(new Properties());
+
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ StandardServiceRegistryImpl registry = null;
MavenLogAppender.startPluginLog(this);
+
try
{
/** Try to read configuration from properties-file */
}
- Iterator<PersistentClass> it = config.getClassMappings();
- if (!it.hasNext())
- {
- throw new MojoFailureException("No mapped classes found!");
- }
- else
- {
- getLog().info("Mapped classes:");
- while (it.hasNext())
- {
- getLog().debug(" " + it.next().getClassName());
- }
- }
-
if (config.getProperty(DIALECT) == null)
throw new MojoFailureException("hibernate-dialect must be set!");
Environment.verifyProperties(config.getProperties());
ConfigurationHelper.resolvePlaceHolders(config.getProperties());
- StandardServiceRegistryImpl registry =
+ registry =
(StandardServiceRegistryImpl)
new StandardServiceRegistryBuilder()
.applySettings(config.getProperties())
/** Restore the old class-loader (TODO: is this really necessary?) */
Thread.currentThread().setContextClassLoader(contextClassLoader);
+
+ if (registry != null)
+ registry.destroy();
}
/** Write md5-sums for annotated classes to file */