Skip to content

Commit 21832fe

Browse files
author
bretislav.wajtr
committed
Moved jooq generator configuration to pom.xml, so the classes can be generated using maven
Just run "mvn jooq-codegen:generate" to regenerate the classes
1 parent 1933b0b commit 21832fe

3 files changed

Lines changed: 129 additions & 98 deletions

File tree

jooqgenerator/generate.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

jooqgenerator/test-schema.xml

Lines changed: 0 additions & 47 deletions
This file was deleted.

pom.xml

Lines changed: 129 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,145 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
6-
<groupId>com.clevergang</groupId>
7-
<artifactId>java-repo-layer-comparison</artifactId>
8-
<version>0.0.1-SNAPSHOT</version>
9-
<packaging>jar</packaging>
10-
11-
<name>java-repo-layer-comparison</name>
12-
<description>Comparison of non-JPA SQL mapping frameworks for Java (Jooq, Spring JDBCTemplate etc.)</description>
13-
14-
<parent>
15-
<groupId>org.springframework.boot</groupId>
16-
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.3.2.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
19-
</parent>
20-
21-
<properties>
22-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23-
<java.version>1.8</java.version>
24-
</properties>
25-
26-
<dependencies>
27-
<dependency>
28-
<groupId>org.springframework.boot</groupId>
29-
<artifactId>spring-boot-starter-jdbc</artifactId>
30-
</dependency>
31-
<dependency>
32-
<groupId>org.springframework.boot</groupId>
33-
<artifactId>spring-boot-starter-jooq</artifactId>
34-
</dependency>
35-
<dependency>
36-
<groupId>org.springframework.boot</groupId>
37-
<artifactId>spring-boot-starter-test</artifactId>
38-
<scope>test</scope>
39-
</dependency>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.clevergang</groupId>
7+
<artifactId>java-repo-layer-comparison</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>jar</packaging>
10+
11+
<name>java-repo-layer-comparison</name>
12+
<description>Comparison of non-JPA SQL mapping frameworks for Java (Jooq, Spring JDBCTemplate etc.)</description>
13+
14+
<parent>
15+
<groupId>org.springframework.boot</groupId>
16+
<artifactId>spring-boot-starter-parent</artifactId>
17+
<version>1.3.2.RELEASE</version>
18+
<relativePath/> <!-- lookup parent from repository -->
19+
</parent>
20+
21+
<properties>
22+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<java.version>1.8</java.version>
24+
</properties>
25+
26+
<dependencies>
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-jdbc</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-starter-jooq</artifactId>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.springframework.boot</groupId>
37+
<artifactId>spring-boot-starter-test</artifactId>
38+
<scope>test</scope>
39+
</dependency>
4040

4141
<dependency>
4242
<groupId>org.postgresql</groupId>
4343
<artifactId>postgresql</artifactId>
44+
<version>9.4-1201-jdbc41</version>
4445
<scope>runtime</scope>
4546
</dependency>
47+
4648
<dependency>
4749
<groupId>org.apache.commons</groupId>
4850
<artifactId>commons-lang3</artifactId>
4951
<version>3.4</version>
5052
</dependency>
5153
</dependencies>
52-
53-
<build>
54-
<plugins>
55-
<plugin>
56-
<groupId>org.springframework.boot</groupId>
57-
<artifactId>spring-boot-maven-plugin</artifactId>
58-
</plugin>
59-
</plugins>
60-
</build>
61-
54+
55+
<build>
56+
<plugins>
57+
<plugin>
58+
<groupId>org.springframework.boot</groupId>
59+
<artifactId>spring-boot-maven-plugin</artifactId>
60+
</plugin>
61+
62+
<!-- You can use this plugin to generate classes needed by Jooq -->
63+
<!-- Just run it using 'mvn jooq-codegen:generate' -->
64+
<!-- Generated classes will go to ./src/main/java/com/clevergang/dbtests/service/repository/impl/jooq/generated -->
65+
<plugin>
66+
67+
<!-- Specify the maven code generator plugin -->
68+
<groupId>org.jooq</groupId>
69+
<artifactId>jooq-codegen-maven</artifactId>
70+
<version>3.7.2</version>
71+
72+
<!-- The plugin should hook into the generate goal -->
73+
<executions>
74+
<execution>
75+
<goals>
76+
<goal>generate</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
81+
<!-- Manage the plugin's dependency. In this example, we'll use a PostgreSQL database -->
82+
<dependencies>
83+
<dependency>
84+
<groupId>org.postgresql</groupId>
85+
<artifactId>postgresql</artifactId>
86+
<version>9.4-1201-jdbc41</version>
87+
</dependency>
88+
</dependencies>
89+
90+
<!-- Specify the plugin configuration.
91+
The configuration format is the same as for the standalone code generator -->
92+
<configuration>
93+
<!-- Configure the database connection here -->
94+
<jdbc>
95+
<driver>org.postgresql.Driver</driver>
96+
<url>jdbc:postgresql://localhost:5432/testdb</url>
97+
<user>test</user>
98+
<password>test</password>
99+
</jdbc>
100+
101+
<generator>
102+
<!-- The default code generator. You can override this one, to generate your own code style.
103+
Supported generators:
104+
- org.jooq.util.JavaGenerator
105+
- org.jooq.util.ScalaGenerator
106+
Defaults to org.jooq.util.JavaGenerator -->
107+
<name>org.jooq.util.JavaGenerator</name>
108+
109+
<database>
110+
<!-- The database type. The format here is:
111+
org.util.[database].[database]Database -->
112+
<name>org.jooq.util.postgres.PostgresDatabase</name>
113+
114+
<!-- The database schema (or in the absence of schema support, in your RDBMS this
115+
can be the owner, user, database name) to be generated -->
116+
<inputSchema>public</inputSchema>
117+
118+
<!-- All elements that are generated from your schema
119+
(A Java regular expression. Use the pipe to separate several expressions)
120+
Watch out for case-sensitivity. Depending on your database, this might be important! -->
121+
<includes>.*</includes>
122+
123+
<!-- All elements that are excluded from your schema
124+
(A Java regular expression. Use the pipe to separate several expressions).
125+
Excludes match before includes -->
126+
<!--<excludes></excludes>-->
127+
</database>
128+
129+
<target>
130+
<!-- The destination package of your generated classes (within the destination directory) -->
131+
<packageName>com.clevergang.dbtests.service.repository.impl.jooq.generated</packageName>
132+
133+
<!-- The destination directory of your generated classes -->
134+
<directory>./src/main/java/</directory>
135+
</target>
136+
</generator>
137+
</configuration>
138+
</plugin>
139+
140+
141+
</plugins>
142+
</build>
143+
62144

63145
</project>

0 commit comments

Comments
 (0)