X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fplugins%2Fhibernate4%2FHbm2DdlMojo.java;h=a37176cc78771eaf3fbbde6ca0f3c4eeef4fb254;hp=83f53d3d56d05a048f40084fc3c3ab8b0a94c4e2;hb=5da1114d419ae10f94a83ad56cea9856a39f00b6;hpb=221d977368ee1897377f80bfcdd50dcbcd1d4b83
diff --git a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
index 83f53d3d..a37176cc 100644
--- a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
+++ b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
@@ -30,14 +30,11 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
-import java.sql.Connection;
import java.sql.Driver;
-import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Comparator;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -58,9 +55,12 @@ import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
-import org.hibernate.cfg.Configuration;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
+import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
-import org.hibernate.envers.configuration.AuditConfiguration;
+import org.hibernate.envers.configuration.spi.AuditConfiguration;
+import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2ddl.SchemaExport.Type;
import org.hibernate.tool.hbm2ddl.Target;
@@ -88,7 +88,7 @@ public class Hbm2DdlMojo extends AbstractMojo
public final static String NAMING_STRATEGY="hibernate.ejb.naming_strategy";
public final static String ENVERS = "hibernate.export.envers";
- public final static String MD5S = "schema.md5s";
+ public final static String MD5S = "hibernate4-generatedschema.md5s";
private final static Pattern split = Pattern.compile("[^,\\s]+");
@@ -119,19 +119,21 @@ public class Hbm2DdlMojo extends AbstractMojo
* Classes-Directory to scan.
*
* This parameter defaults to the maven build-output-directory for classes.
- * Additonally, all dependencies are scanned for annotated classes.
+ * Additionally, all dependencies are scanned for annotated classes.
*
* @parameter property="project.build.outputDirectory"
+ * @since 1.0
*/
private String outputDirectory;
/**
- * Wether to scan test-classes too, or not.
+ * Whether to scan test-classes too, or not.
*
* If this parameter is set to true the test-classes of the
* artifact will be scanned for hibernate-annotated classes additionally.
*
* @parameter property="hibernate.export.scan_testclasses" default-value="false"
+ * @since 1.0.1
*/
private boolean scanTestClasses;
@@ -142,11 +144,15 @@ public class Hbm2DdlMojo extends AbstractMojo
* scanned for annotated classes. Multiple scopes can be seperated by
* white space or commas.
*
+ * If you do not want any dependencies to be scanned for annotated
+ * classes, set this parameter to none.
+ *
* The plugin does not scan for annotated classes in transitive
* dependencies. If some of your annotated classes are hidden in a
* transitive dependency, you can simply add that dependency explicitly.
*
* @parameter property="hibernate.export.scan_dependencies" default-value="compile"
+ * @since 1.0.3
*/
private String scanDependencies;
@@ -160,6 +166,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* to true!
*
* @parameter property="project.build.testOutputDirectory"
+ * @since 1.0.2
*/
private String testOutputDirectory;
@@ -168,13 +175,14 @@ public class Hbm2DdlMojo extends AbstractMojo
*
* If set to true, the execution is skipped.
*
- * A skipped excecution is signaled via the maven-property
+ * A skipped execution is signaled via the maven-property
* ${hibernate.export.skipped}.
*
- * The excecution is skipped automatically, if no modified or newly added
+ * The execution is skipped automatically, if no modified or newly added
* annotated classes are found and the dialect was not changed.
*
- * @parameter property="maven.test.skip" default-value="false"
+ * @parameter property="hibernate.skip" default-value="${maven.test.skip}"
+ * @since 1.0
*/
private boolean skip;
@@ -187,6 +195,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* skip takes precedence over force.
*
* @parameter property="hibernate.export.force" default-value="false"
+ * @since 1.0
*/
private boolean force;
@@ -194,6 +203,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* SQL-Driver name.
*
* @parameter property="hibernate.connection.driver_class"
+ * @since 1.0
*/
private String driverClassName;
@@ -201,6 +211,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* Database URL.
*
* @parameter property="hibernate.connection.url"
+ * @since 1.0
*/
private String url;
@@ -208,6 +219,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* Database username
*
* @parameter property="hibernate.connection.username"
+ * @since 1.0
*/
private String username;
@@ -215,6 +227,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* Database password
*
* @parameter property="hibernate.connection.password"
+ * @since 1.0
*/
private String password;
@@ -222,12 +235,15 @@ public class Hbm2DdlMojo extends AbstractMojo
* Hibernate dialect.
*
* @parameter property="hibernate.dialect"
+ * @since 1.0
*/
private String hibernateDialect;
/**
* Hibernate Naming Strategy
+ *
* @parameter property="hibernate.ejb.naming_strategy"
+ * @since 1.0.2
*/
private String hibernateNamingStrategy;
@@ -235,6 +251,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* Path to Hibernate configuration file.
*
* @parameter default-value="${project.build.outputDirectory}/hibernate.properties"
+ * @since 1.0
*/
private String hibernateProperties;
@@ -243,22 +260,24 @@ public class Hbm2DdlMojo extends AbstractMojo
* Multiple files can be separated with white-spaces and/or commas.
*
* @parameter property="hibernate.mapping"
+ * @since 1.0.2
*/
private String hibernateMapping;
/**
* Target of execution:
*
- *
NONE only export schema to SQL-script (forces excecution, signals skip)