X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fplugins%2Fhibernate4%2FHbm2DdlMojo.java;h=ef983c2dc83041c218d9bc61fff05c5c72ac399d;hb=5fba40e135677130cbe0ff3c59f6055228293d92;hp=2e232bf1cbb7080be6f917bfc85ae2296e865acb;hpb=d38b2386641c7ca00f54d69cb3f576c20b0cdccc;p=hibernate-maven-plugin diff --git a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java index 2e232bf1..ef983c2d 100644 --- a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java @@ -47,9 +47,12 @@ import java.util.Properties; import java.util.Set; import java.util.TreeSet; import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.persistence.Embeddable; import javax.persistence.Entity; import javax.persistence.MappedSuperclass; +import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -57,7 +60,7 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.NamingStrategy; -import org.hibernate.envers.configuration.AuditConfiguration; +import org.hibernate.envers.configuration.spi.AuditConfiguration; import org.hibernate.tool.hbm2ddl.SchemaExport; import org.hibernate.tool.hbm2ddl.SchemaExport.Type; import org.hibernate.tool.hbm2ddl.Target; @@ -85,7 +88,10 @@ public class Hbm2DdlMojo extends AbstractMojo public final static String NAMING_STRATEGY="hibernate.ejb.naming_strategy"; public final static String ENVERS = "hibernate.export.envers"; - private final static String MD5S = "schema.md5s"; + public final static String MD5S = "hibernate4-generatedschema.md5s"; + + private final static Pattern split = Pattern.compile("[^,\\s]+"); + /** * The maven project. @@ -113,22 +119,40 @@ 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;
+ /**
+ * Dependency-Scopes, that should be scanned for annotated classes.
+ *
+ * By default, only dependencies in the scope compile
are
+ * scanned for annotated classes. Multiple scopes can be seperated by
+ * white space or commas.
+ *
+ * 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; + /** * Test-Classes-Directory to scan. *
@@ -139,6 +163,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* to true
!
*
* @parameter property="project.build.testOutputDirectory"
+ * @since 1.0.2
*/
private String testOutputDirectory;
@@ -147,13 +172,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;
@@ -166,6 +192,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;
@@ -173,6 +200,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* SQL-Driver name.
*
* @parameter property="hibernate.connection.driver_class"
+ * @since 1.0
*/
private String driverClassName;
@@ -180,6 +208,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* Database URL.
*
* @parameter property="hibernate.connection.url"
+ * @since 1.0
*/
private String url;
@@ -187,6 +216,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* Database username
*
* @parameter property="hibernate.connection.username"
+ * @since 1.0
*/
private String username;
@@ -194,6 +224,7 @@ public class Hbm2DdlMojo extends AbstractMojo
* Database password
*
* @parameter property="hibernate.connection.password"
+ * @since 1.0
*/
private String password;
@@ -201,12 +232,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;
@@ -214,6 +248,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;
@@ -222,22 +257,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:
*