Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ public void execute() throws MojoFailureException {
Thread.currentThread().setContextClassLoader(createExporterClassLoader(original));
getLog().info("Starting " + this.getClass().getSimpleName() + "...");
ReverseEngineeringStrategy strategy = setupReverseEngineeringStrategy();
if (propertyFile.exists()) {
executeExporter(createJdbcDescriptor(strategy, loadPropertiesFile()));
} else {
getLog().info("Property file '" + propertyFile + "' cannot be found, aborting...");
}
executeExporter(createJdbcDescriptor(strategy, loadPropertiesFile()));
getLog().info("Finished " + this.getClass().getSimpleName() + "!");
} finally {
Thread.currentThread().setContextClassLoader(original);
Expand Down Expand Up @@ -122,8 +118,10 @@ private Properties loadPropertiesFile() throws MojoFailureException {
result.load(is);
return result;
} catch (FileNotFoundException e) {
getLog().error("Property file '" + propertyFile + "' cannot be found, aborting...");
throw new MojoFailureException(propertyFile + " not found.", e);
} catch (IOException e) {
getLog().error("Property file '" + propertyFile + "' cannot be loaded, aborting...");
throw new MojoFailureException("Problem while loading " + propertyFile, e);
}
}
Expand Down
10 changes: 9 additions & 1 deletion test/maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<settingsFile>src/it/settings.xml</settingsFile>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<preBuildHookScript>before</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
<goal>install</goal>
<goal>generate-sources</goal>
</configuration>
<executions>
<execution>
Expand All @@ -40,6 +41,13 @@
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
9 changes: 9 additions & 0 deletions test/maven-plugin/src/it/generateHbm/before.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import java.sql.DriverManager;
import java.sql.Connection;

String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test";
String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))";

Connection connection = DriverManager.getConnection(JDBC_CONNECTION);
connection.createStatement().execute(CREATE_PERSON_TABLE);
connection.close();
3 changes: 1 addition & 2 deletions test/maven-plugin/src/it/generateHbm/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
invoker.java.version = 1.8+
invoker.goals = generate-resources
invoker.goals = generate-sources
27 changes: 8 additions & 19 deletions test/maven-plugin/src/it/generateHbm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<artifactId>hbm2ddl</artifactId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<java.version>1.8</java.version>
<h2.version>1.4.195</h2.version>
</properties>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>@h2.version@</version>
</dependency>
</dependencies>

<build>
<plugins>
Expand All @@ -25,7 +25,7 @@
<executions>
<execution>
<id>HBM generation</id>
<phase>generate-resources</phase>
<phase>generate-sources</phase>
<goals>
<goal>generateHbm</goal>
</goals>
Expand All @@ -35,17 +35,6 @@
</configuration>
</execution>
</executions>
<configuration>
<revengFile>${project.basedir}/src/main/resources/hibernate.reveng.xml</revengFile>
</configuration>
<dependencies>
<dependency>
<!-- DB Driver of your choice -->
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:./test;DB_CLOSE_ON_EXIT=FALSE
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.pool_size=1
hibernate.show_sql=true
hibernate.connection.url=jdbc:h2:./test
hibernate.default_catalog=TEST
hibernate.default_schema=PUBLIC

This file was deleted.

Binary file removed test/maven-plugin/src/it/generateHbm/test.mv.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import java.io.*;

File file = new File(basedir, "target/generated-sources/Person.hbm.xml");
if (!file.isFile()) {
throw new FileNotFoundException("Could not find generated HBM file: " + file);
Expand Down
9 changes: 9 additions & 0 deletions test/maven-plugin/src/it/hbm2dao/before.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import java.sql.DriverManager;
import java.sql.Connection;

String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test";
String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))";

Connection connection = DriverManager.getConnection(JDBC_CONNECTION);
connection.createStatement().execute(CREATE_PERSON_TABLE);
connection.close();
1 change: 0 additions & 1 deletion test/maven-plugin/src/it/hbm2dao/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
invoker.java.version = 1.8+
invoker.goals = generate-sources
27 changes: 8 additions & 19 deletions test/maven-plugin/src/it/hbm2dao/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<artifactId>hbm2dao</artifactId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<java.version>1.8</java.version>
<h2.version>1.4.195</h2.version>
</properties>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>@h2.version@</version>
</dependency>
</dependencies>

<build>
<plugins>
Expand All @@ -34,18 +34,7 @@
</configuration>
</execution>
</executions>
<configuration>
<revengFile>${project.basedir}/src/main/resources/hibernate.reveng.xml</revengFile>
</configuration>
<dependencies>
<dependency>
<!-- DB Driver of your choice -->
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
</dependencies>
</plugin>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:./test;DB_CLOSE_ON_EXIT=FALSE
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.pool_size=1
hibernate.show_sql=true
hibernate.connection.url=jdbc:h2:./test
hibernate.default_catalog=TEST
hibernate.default_schema=PUBLIC

This file was deleted.

Binary file removed test/maven-plugin/src/it/hbm2dao/test.mv.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import java.io.*;

File dao = new File(basedir, "target/generated-sources/PersonHome.java");
if (!dao.isFile()) {
throw new FileNotFoundException("Could not find generated JPA DAO: " + dao);
Expand Down
9 changes: 9 additions & 0 deletions test/maven-plugin/src/it/hbm2ddl/before.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import java.sql.DriverManager;
import java.sql.Connection;

String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test";
String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))";

Connection connection = DriverManager.getConnection(JDBC_CONNECTION);
connection.createStatement().execute(CREATE_PERSON_TABLE);
connection.close();
3 changes: 1 addition & 2 deletions test/maven-plugin/src/it/hbm2ddl/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
invoker.java.version = 1.8+
invoker.goals = generate-resources
invoker.goals = generate-sources
27 changes: 8 additions & 19 deletions test/maven-plugin/src/it/hbm2ddl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<artifactId>hbm2ddl</artifactId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<java.version>1.8</java.version>
<h2.version>1.4.195</h2.version>
</properties>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>@h2.version@</version>
</dependency>
</dependencies>

<build>
<plugins>
Expand All @@ -25,7 +25,7 @@
<executions>
<execution>
<id>Schema generation</id>
<phase>generate-resources</phase>
<phase>generate-sources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
Expand All @@ -34,17 +34,6 @@
</configuration>
</execution>
</executions>
<configuration>
<revengFile>${project.basedir}/src/main/resources/hibernate.reveng.xml</revengFile>
</configuration>
<dependencies>
<dependency>
<!-- DB Driver of your choice -->
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:./test;DB_CLOSE_ON_EXIT=FALSE
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.pool_size=1
hibernate.show_sql=true
hibernate.connection.url=jdbc:h2:./test
hibernate.default_catalog=TEST
hibernate.default_schema=PUBLIC

This file was deleted.

Binary file removed test/maven-plugin/src/it/hbm2ddl/test.mv.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import java.io.*;

File schema = new File(basedir, "target/generated-resources/schema.ddl");
if (!schema.isFile()) {
throw new FileNotFoundException("Could not find generated schema file: " + schema);
Expand Down
9 changes: 9 additions & 0 deletions test/maven-plugin/src/it/hbm2java/before.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import java.sql.DriverManager;
import java.sql.Connection;

String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test";
String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))";

Connection connection = DriverManager.getConnection(JDBC_CONNECTION);
connection.createStatement().execute(CREATE_PERSON_TABLE);
connection.close();
1 change: 0 additions & 1 deletion test/maven-plugin/src/it/hbm2java/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
invoker.java.version = 1.8+
invoker.goals = generate-sources
25 changes: 7 additions & 18 deletions test/maven-plugin/src/it/hbm2java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<artifactId>hbm2java</artifactId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<java.version>1.8</java.version>
<h2.version>1.4.195</h2.version>
</properties>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>@h2.version@</version>
</dependency>
</dependencies>

<build>
<plugins>
Expand All @@ -34,17 +34,6 @@
</configuration>
</execution>
</executions>
<configuration>
<revengFile>${project.basedir}/src/main/resources/hibernate.reveng.xml</revengFile>
</configuration>
<dependencies>
<dependency>
<!-- DB Driver of your choice -->
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:./test;DB_CLOSE_ON_EXIT=FALSE
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.pool_size=1
hibernate.show_sql=true
hibernate.connection.url=jdbc:h2:./test
hibernate.default_catalog=TEST
hibernate.default_schema=PUBLIC
Loading