Skip to content

Instantly share code, notes, and snippets.

@raglin
Created October 30, 2018 04:53
Show Gist options
  • Select an option

  • Save raglin/c507b9b1a350a8b318e4c2b46164f068 to your computer and use it in GitHub Desktop.

Select an option

Save raglin/c507b9b1a350a8b318e4c2b46164f068 to your computer and use it in GitHub Desktop.
create jooq db objects from ddl
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
</dependency>
</dependencies>
<configuration>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/h2_db</url>
<username>sa</username>
<password></password>
<autocommit>true</autocommit>
<settingsKey>hsql-db-test</settingsKey>
</configuration>
<executions>
<execution>
<id>create-test-compile-data</id>
<phase>generate-test-sources</phase>
<inherited>true</inherited>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<fileset>
<basedir>${project.basedir}/src/test/resources/</basedir>
<includes>
<include>dummy.sql</include>
</includes>
</fileset>
<autocommit>true</autocommit>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<executions>
<execution>
<phase>generate-test-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
</dependency>
</dependencies>
<configuration>
<jdbc>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/h2_db</url>
<user>sa</user>
<password></password>
</jdbc>
<generator>
<name>org.jooq.codegen.JavaGenerator</name>
<database>
<name>org.jooq.meta.h2.H2Database</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>PUBLIC</inputSchema>
</database>
<generate></generate>
<target>
<packageName>jooq.db</packageName>
<directory>${project.build.directory}/generated-sources/java</directory>
</target>
</generator>
</configuration>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment