projects
/
hibernate4-maven-plugin
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
55dc25a
)
WIP
2.0
author
Kai Moritz
<kai@juplo.de>
Sat, 2 May 2015 20:26:32 +0000
(22:26 +0200)
committer
Kai Moritz
<kai@juplo.de>
Sat, 2 May 2015 20:26:32 +0000
(22:26 +0200)
src/it/dependency test/h4mp/pom.xml
patch
|
blob
|
history
src/it/hib-test/pom.xml
patch
|
blob
|
history
src/it/hibernate4-maven-plugin-envers-sample/pom.xml
patch
|
blob
|
history
src/it/ignored-dependency/main/pom.xml
patch
|
blob
|
history
src/it/properties/pom.xml
patch
|
blob
|
history
src/it/schemaexport-example/schemaexport-example-persistence-impl/pom.xml
patch
|
blob
|
history
src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
patch
|
blob
|
history
diff --git
a/src/it/dependency test/h4mp/pom.xml
b/src/it/dependency test/h4mp/pom.xml
index
4e179d2
..
a02802d
100644
(file)
--- a/
src/it/dependency test/h4mp/pom.xml
+++ b/
src/it/dependency test/h4mp/pom.xml
@@
-71,12
+71,12
@@
</execution>
</executions>
<configuration>
</execution>
</executions>
<configuration>
- <
target>NONE</targe
t>
+ <
export>false</expor
t>
<envers>true</envers>
<format>true</format>
<delimiter>;</delimiter>
<force>true</force>
<envers>true</envers>
<format>true</format>
<delimiter>;</delimiter>
<force>true</force>
- <
type>CREATE</type
>
+ <
drop>false</drop
>
<hibernateDialect>org.hibernate.dialect.PostgreSQL9Dialect</hibernateDialect>
</configuration>
</plugin>
<hibernateDialect>org.hibernate.dialect.PostgreSQL9Dialect</hibernateDialect>
</configuration>
</plugin>
diff --git
a/src/it/hib-test/pom.xml
b/src/it/hib-test/pom.xml
index
fe46e32
..
5b34a02
100644
(file)
--- a/
src/it/hib-test/pom.xml
+++ b/
src/it/hib-test/pom.xml
@@
-45,10
+45,8
@@
<artifactId>hibernate4-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<artifactId>hibernate4-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
- <!-- Target of none generates schema only, no DB connection -->
- <target>none</target>
- <!-- Generate both CREATE and DROP statements in scripts -->
- <type>both</type>
+ <!-- Generat schema only, no DB connection needed -->
+ <export>false</export>
</configuration>
<executions>
<execution>
</configuration>
<executions>
<execution>
diff --git
a/src/it/hibernate4-maven-plugin-envers-sample/pom.xml
b/src/it/hibernate4-maven-plugin-envers-sample/pom.xml
index
3ca641d
..
2eda723
100644
(file)
--- a/
src/it/hibernate4-maven-plugin-envers-sample/pom.xml
+++ b/
src/it/hibernate4-maven-plugin-envers-sample/pom.xml
@@
-82,8
+82,8
@@
<configuration>
<outputFile>${project.build.sourceDirectory}/../scripts/sql/create-tables-hsqldb.sql
</outputFile>
<configuration>
<outputFile>${project.build.sourceDirectory}/../scripts/sql/create-tables-hsqldb.sql
</outputFile>
- <
target>SCRIPT</targe
t>
- <
type>CREATE</type
>
+ <
export>false</expor
t>
+ <
drop>false</drop
>
</configuration>
<dependencies>
<dependency>
</configuration>
<dependencies>
<dependency>
diff --git
a/src/it/ignored-dependency/main/pom.xml
b/src/it/ignored-dependency/main/pom.xml
index
d198fc9
..
ce06ae0
100644
(file)
--- a/
src/it/ignored-dependency/main/pom.xml
+++ b/
src/it/ignored-dependency/main/pom.xml
@@
-40,9
+40,9
@@
</execution>
</executions>
<configuration>
</execution>
</executions>
<configuration>
- <
target>NONE</targe
t>
+ <
export>false</expor
t>
<format>true</format>
<format>true</format>
- <
type>CREATE</type
>
+ <
drop>false</drop
>
<hibernateDialect>org.hibernate.dialect.PostgreSQL9Dialect</hibernateDialect>
<scanDependencies>none</scanDependencies>
</configuration>
<hibernateDialect>org.hibernate.dialect.PostgreSQL9Dialect</hibernateDialect>
<scanDependencies>none</scanDependencies>
</configuration>
diff --git
a/src/it/properties/pom.xml
b/src/it/properties/pom.xml
index
f3a6fc7
..
a4d4e9f
100644
(file)
--- a/
src/it/properties/pom.xml
+++ b/
src/it/properties/pom.xml
@@
-35,10
+35,8
@@
<artifactId>hibernate4-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<artifactId>hibernate4-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
- <!-- Target of none generates schema only, no DB connection -->
- <target>none</target>
- <!-- Generate both CREATE and DROP statements in scripts -->
- <type>both</type>
+ <!-- Gnerate schema only, no DB connection needed -->
+ <export>false</export>
</configuration>
<executions>
<execution>
</configuration>
<executions>
<execution>
diff --git
a/src/it/schemaexport-example/schemaexport-example-persistence-impl/pom.xml
b/src/it/schemaexport-example/schemaexport-example-persistence-impl/pom.xml
index
e7c7419
..
f5e467d
100644
(file)
--- a/
src/it/schemaexport-example/schemaexport-example-persistence-impl/pom.xml
+++ b/
src/it/schemaexport-example/schemaexport-example-persistence-impl/pom.xml
@@
-56,7
+56,7
@@
<artifactId>hibernate4-maven-plugin</artifactId>
\r
<version>@project.version@</version>
\r
<configuration>
\r
<artifactId>hibernate4-maven-plugin</artifactId>
\r
<version>@project.version@</version>
\r
<configuration>
\r
- <
target>SCRIPT</targe
t>
\r
+ <
export>false</expor
t>
\r
<driverClassName>org.hsqldb.jdbcDriver</driverClassName>
\r
<hibernateDialect>org.hibernate.dialect.HSQLDialect</hibernateDialect>
\r
<!--
\r
<driverClassName>org.hsqldb.jdbcDriver</driverClassName>
\r
<hibernateDialect>org.hibernate.dialect.HSQLDialect</hibernateDialect>
\r
<!--
\r
@@
-74,4
+74,4
@@
</plugin>
\r
</plugins>
\r
</build>
\r
</plugin>
\r
</plugins>
\r
</build>
\r
-</project>
\ No newline at end of file
+</project>
\r
diff --git
a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
index
b85c601
..
0ba4673
100644
(file)
--- a/
src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
+++ b/
src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
@@
-262,36
+262,30
@@
public class Hbm2DdlMojo extends AbstractMojo
private String hibernateMapping;
/**
private String hibernateMapping;
/**
- * Do not output the script to stdout.
- *
- * @parameter property="hibernate.export.quiet" default-value="true"
- * @since 1.0.6
- */
- private boolean quiet;
-
- /**
- * Only drop the tables.
+ * Create drop-statements for the generated tables.
+ * At least one of {@link #drop} and {@link #create} must be set.
*
* @parameter property="hibernate.export.drop" default-value="true"
*
* @parameter property="hibernate.export.drop" default-value="true"
- * @since
1.0.6
+ * @since
2.0
*/
private boolean drop;
/**
*/
private boolean drop;
/**
- * Only create the tables.
+ * Create create-statements for the generated tables.
+ * At least one of {@link #drop} and {@link #create} must be set.
*
* @parameter property="hibernate.export.create" default-value="true"
*
* @parameter property="hibernate.export.create" default-value="true"
- * @since
1.0.6
+ * @since
2.0
*/
private boolean create;
/**
*/
private boolean create;
/**
- *
Do not expor
t to the database.
+ *
Only create the database schema. Do not export i
t to the database.
*
*
- * @parameter property="hibernate.export.
text" default-value="fals
e"
- * @since
1.0.6
+ * @parameter property="hibernate.export.
export" default-value="tru
e"
+ * @since
2.0
*/
*/
- private boolean
tex
t;
+ private boolean
expor
t;
/**
* Output file.
/**
* Output file.
@@
-339,6
+333,11
@@
public class Hbm2DdlMojo extends AbstractMojo
return;
}
return;
}
+ if (!create && !drop)
+ throw new MojoFailureException(
+ "At least one of drop and create must be set!"
+ );
+
Map<String,String> md5s;
boolean modified = false;
File saved = new File(buildDirectory + File.separator + MD5S);
Map<String,String> md5s;
boolean modified = false;
File saved = new File(buildDirectory + File.separator + MD5S);
@@
-791,10
+790,12
@@
public class Hbm2DdlMojo extends AbstractMojo
if (!modified)
{
getLog().info(
if (!modified)
{
getLog().info(
- "No modified annotated classes or mapping-files found and dialect " +
- "unchanged."
- );
- if (!force)
+ "No modified annotated classes or mapping-files found and " +
+ "dialect unchanged."
+ );
+ if (force)
+ getLog().info("Schema generation is forced!");
+ else
{
getLog().info("Skipping schema generation!");
project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true");
{
getLog().info("Skipping schema generation!");
project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true");
@@
-809,7
+810,7
@@
public class Hbm2DdlMojo extends AbstractMojo
* hibernate does not use the context-classloader of the current
* thread and, hence, would not be able to resolve the driver-class!
*/
* hibernate does not use the context-classloader of the current
* thread and, hence, would not be able to resolve the driver-class!
*/
- if (
!text && (create || drop)
)
+ if (
export
)
{
Class driverClass = classLoader.loadClass(properties.getProperty(DRIVER_CLASS));
getLog().debug("Registering JDBC-driver " + driverClass.getName());
{
Class driverClass = classLoader.loadClass(properties.getProperty(DRIVER_CLASS));
getLog().debug("Registering JDBC-driver " + driverClass.getName());
@@
-882,7
+883,7
@@
public class Hbm2DdlMojo extends AbstractMojo
}
export.setOutputFile(outF.getPath());
}
export.setOutputFile(outF.getPath());
- export.execute(
!quiet, !text, drop, create
);
+ export.execute(
false, this.export, drop && !create, create && !drop
);
for (Object exception : export.getExceptions())
getLog().debug(exception.toString());
for (Object exception : export.getExceptions())
getLog().debug(exception.toString());