From 06dfaf5a2b0a0a411d410580cd746270579ac2e3 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 5 May 2014 14:03:03 +0200 Subject: [PATCH] [#682] Added code generation Maven profiles. Are these the right tool? --- .../org.eclipse.core.resources.prefs | 1 + jOOQ-test/.classpath | 18 +- .../GenerationTool Postgres test.launch | 8 +- jOOQ-test/pom.xml | 399 +++++++++++++++++- .../src/main/resources/config.properties | 10 + .../org.eclipse.core.resources.prefs | 1 + pom.xml | 6 +- 7 files changed, 416 insertions(+), 27 deletions(-) create mode 100644 jOOQ-test/src/main/resources/config.properties diff --git a/jOOQ-meta/.settings/org.eclipse.core.resources.prefs b/jOOQ-meta/.settings/org.eclipse.core.resources.prefs index abdea9ac03..74bee3fd6d 100644 --- a/jOOQ-meta/.settings/org.eclipse.core.resources.prefs +++ b/jOOQ-meta/.settings/org.eclipse.core.resources.prefs @@ -1,4 +1,5 @@ eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 +encoding//target/generated-sources/xjc=UTF-8 encoding/=UTF-8 diff --git a/jOOQ-test/.classpath b/jOOQ-test/.classpath index 17b75abcd3..a03635d04e 100644 --- a/jOOQ-test/.classpath +++ b/jOOQ-test/.classpath @@ -1,5 +1,12 @@ + + + + + + + @@ -11,19 +18,12 @@ - - + - - - - - - - + diff --git a/jOOQ-test/launch/GenerationTool Postgres test.launch b/jOOQ-test/launch/GenerationTool Postgres test.launch index 1686d3c772..55b59b0417 100644 --- a/jOOQ-test/launch/GenerationTool Postgres test.launch +++ b/jOOQ-test/launch/GenerationTool Postgres test.launch @@ -15,13 +15,13 @@ - - - - + + + + diff --git a/jOOQ-test/pom.xml b/jOOQ-test/pom.xml index 8578a2508e..10dd4afd00 100644 --- a/jOOQ-test/pom.xml +++ b/jOOQ-test/pom.xml @@ -7,10 +7,9 @@ org.jooq jooq-parent - 3.4.0-SNAPSHOT + ${jooq.version} - org.jooq jooq-test jOOQ-test @@ -30,6 +29,14 @@ + + UTF-8 + 3.2.6.RELEASE + 1.4.177 + 9.3-1101-jdbc41 + + + org.jooq @@ -48,25 +55,21 @@ log4j log4j 1.2.16 - test org.slf4j slf4j-log4j12 1.6.1 - test org.slf4j integration 1.6.1 - test commons-io commons-io 2.4 - test @@ -75,14 +78,12 @@ junit 4.11 jar - test org.jmock jmock-junit4 2.6.0 jar - test @@ -90,19 +91,16 @@ javax.persistence persistence-api 1.0.2 - test javax.validation validation-api 1.1.0.Final - test javax.resource connector-api 1.5 - test @@ -132,7 +130,7 @@ com.h2database h2 - 1.4.177 + ${db.h2.version} hsqldb @@ -152,7 +150,7 @@ org.postgresql postgresql - 9.3-1101-jdbc41 + ${db.postgres.version} org.postgis @@ -208,4 +206,379 @@ xxxxxxxxxxxxx xxxx [/pro] --> + + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0-alpha-2 + + + initialize + + read-project-properties + + + + src/main/resources/config.properties + + + + + + + + + + + codegen-h2 + + + + org.jooq + jooq-codegen-maven + ${jooq.version} + + + + generate-h2 + generate-sources + + generate + + + + ${db.h2.driver} + ${db.h2.url} + ${db.h2.username} + ${db.h2.password} + + + org.jooq.util.DefaultGenerator + + .* + + T_BOOK_DETAILS # Check if dependent objects (e.g. foreign keys) are not generated + | SYSTEM_SEQUENCE.* # who knows where this came from (sample comment) + | .*\.COL2 # v_2603 contains some columns that we don't want to generate + | COL3 # v_2603 contains some columns that we don't want to generate + + true + + REC_VERSION + | ASDF_ASDF_ASDF # This should not have any effect + + + REC_TIMESTAMP + | ASDF_ASDF_ASDF # This should not have any effect + | ASDF_ASDF_ASDF # This should not have any effect + + false + true + PUBLIC + + + + + + + + org.jooq.test._.converters.Boolean_10 + org.jooq.test._.converters.Boolean_10_Converter + + + org.jooq.test._.converters.Boolean_TF_LC + org.jooq.test._.converters.Boolean_TF_LC_Converter + + + org.jooq.test._.converters.Boolean_TF_UC + org.jooq.test._.converters.Boolean_TF_UC_Converter + + + org.jooq.test._.converters.Boolean_YN_LC + org.jooq.test._.converters.Boolean_YN_LC_Converter + + + org.jooq.test._.converters.Boolean_YN_UC + org.jooq.test._.converters.Boolean_YN_UC_Converter + + + org.jooq.test._.converters.Boolean_YES_NO_LC + org.jooq.test._.converters.Boolean_YES_NO_LC_Converter + + + org.jooq.test._.converters.Boolean_YES_NO_UC + org.jooq.test._.converters.Boolean_YES_NO_UC_Converter + + + + + + BOOLEAN + (?i:(.*?.)?T_BOOLEANS.(VC|C|N)_BOOLEAN) + + + + + TINYINTUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_BYTE) + + + SMALLINTUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_SHORT) + + + INTEGERUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_INT) + + + BIGINTUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_LONG) + + + + org.jooq.test._.converters.Boolean_YES_NO_LC + (?i:(.*?.)?T_BOOLEANS.YES_NO_LC) + + + org.jooq.test._.converters.Boolean_YES_NO_UC + (?i:(.*?.)?T_BOOLEANS.YES_NO_UC) + + + org.jooq.test._.converters.Boolean_YN_LC + (?i:(.*?.)?T_BOOLEANS.Y_N_LC) + + + org.jooq.test._.converters.Boolean_YN_UC + (?i:(.*?.)?T_BOOLEANS.Y_N_UC) + + + org.jooq.test._.converters.Boolean_TF_LC + (?i:(.*?.)?T_BOOLEANS.TRUE_FALSE_LC) + + + org.jooq.test._.converters.Boolean_TF_UC + (?i:(.*?.)?T_BOOLEANS.TRUE_FALSE_UC) + + + org.jooq.test._.converters.Boolean_10 + (?i:(.*?.)?T_BOOLEANS.ONE_ZERO) + + + + + + false + true + + + false + false + + + + true + + + false + + false + true + false + true + + + + org.jooq.test.h2.generatedclasses + + + ./src/test/java + + + + + + + + + com.h2database + h2 + ${db.h2.version} + + + + + + + + + + codegen-postgres + + + + org.jooq + jooq-codegen-maven + ${jooq.version} + + + + generate-postgres + generate-sources + + generate + + + + + ${db.postgres.driver} + ${db.postgres.url} + public + ${db.postgres.username} + ${db.postgres.password} + + + org.jooq.util.DefaultGenerator + + + + + (?i:(.*?.)?T_2781\.(.*)) + + + LOWER + $2 + + + + + + + org.jooq.util.postgres.PostgresDatabase + t_.*|x_.*|v_.*|V_.*|p_.*|f_.*|u_.*|(f|p)[0-9]+|s_.* + t_book_details|.*?_seq|_.* + false + true + + + B10 + org.jooq.test._.converters.Boolean_10 + org.jooq.test._.converters.Boolean_10_Converter + + + org.jooq.test._.converters.Boolean_TF_LC + org.jooq.test._.converters.Boolean_TF_LC_Converter + + + org.jooq.test._.converters.Boolean_TF_UC + org.jooq.test._.converters.Boolean_TF_UC_Converter + + + org.jooq.test._.converters.Boolean_YN_LC + org.jooq.test._.converters.Boolean_YN_LC_Converter + + + org.jooq.test._.converters.Boolean_YN_UC + org.jooq.test._.converters.Boolean_YN_UC_Converter + + + org.jooq.test._.converters.Boolean_YES_NO_LC + org.jooq.test._.converters.Boolean_YES_NO_LC_Converter + + + org.jooq.test._.converters.Boolean_YES_NO_UC + org.jooq.test._.converters.Boolean_YES_NO_UC_Converter + + + + + + BOOLEAN + (?i:(.*?.)?T_BOOLEANS.(VC|C|N)_BOOLEAN) + + + + + TINYINTUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_BYTE) + + + SMALLINTUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_SHORT) + + + INTEGERUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_INT) + + + BIGINTUNSIGNED + (?i:(.*?.)?T_UNSIGNED.U_LONG) + + + + org.jooq.test._.converters.Boolean_YES_NO_LC + (?i:(.*?.)?T_BOOLEANS.YES_NO_LC) + + + org.jooq.test._.converters.Boolean_YES_NO_UC + (?i:(.*?.)?T_BOOLEANS.YES_NO_UC) + + + org.jooq.test._.converters.Boolean_YN_LC + (?i:(.*?.)?T_BOOLEANS.Y_N_LC) + + + org.jooq.test._.converters.Boolean_YN_UC + (?i:(.*?.)?T_BOOLEANS.Y_N_UC) + + + org.jooq.test._.converters.Boolean_TF_LC + (?i:(.*?.)?T_BOOLEANS.TRUE_FALSE_LC) + + + org.jooq.test._.converters.Boolean_TF_UC + (?i:(.*?.)?T_BOOLEANS.TRUE_FALSE_UC) + + + B10 + (?i:(.*?.)?T_BOOLEANS.ONE_ZERO) + + + + + true + false + true + false + true + true + true + false + true + + + org.jooq.test.postgres.generatedclasses + ./src/test/java + + + + + + + + org.postgresql + postgresql + ${db.postgres.version} + + + + + + + \ No newline at end of file diff --git a/jOOQ-test/src/main/resources/config.properties b/jOOQ-test/src/main/resources/config.properties new file mode 100644 index 0000000000..1698152de9 --- /dev/null +++ b/jOOQ-test/src/main/resources/config.properties @@ -0,0 +1,10 @@ +#Database Configuration +db.h2.driver=org.h2.Driver +db.h2.url=jdbc:h2:~/test +db.h2.username=sa +db.h2.password= + +db.postgres.driver=org.postgresql.Driver +db.postgres.url=jdbc:postgresql://localhost:5434/postgres +db.postgres.username=postgres +db.postgres.password=test \ No newline at end of file diff --git a/jOOQ/.settings/org.eclipse.core.resources.prefs b/jOOQ/.settings/org.eclipse.core.resources.prefs index 839d647eef..a37cfca45c 100644 --- a/jOOQ/.settings/org.eclipse.core.resources.prefs +++ b/jOOQ/.settings/org.eclipse.core.resources.prefs @@ -2,4 +2,5 @@ eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 +encoding//target/generated-sources/xjc=UTF-8 encoding/=UTF-8 diff --git a/pom.xml b/pom.xml index 33ead6e00e..d64bd0868d 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.jooq jooq-parent - 3.4.0-SNAPSHOT + ${jooq.version} pom jOOQ Parent @@ -39,6 +39,10 @@ xxxx [/pro] --> + + 3.4.0-SNAPSHOT + + https://github.com/jOOQ/jOOQ.git https://github.com/jOOQ/jOOQ.git