From 67836af4dfe206ed7f2b4d69148a3b627c95dbb2 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 26 Sep 2011 18:09:10 +0000 Subject: [PATCH] Added documentation for the jOOQ Maven plugin --- jOOQ-website/contribute.php | 4 +- jOOQ-website/frame.php | 7 +- jOOQ-website/manual-single-page/index.php | 76 ++++++++++++++++++- .../manual/META/Configuration/index.php | 74 ++++++++++++++++++ jOOQ-website/manual/index.php | 2 +- jOOQ-website/robots.txt | 3 + jOOQ-website/src/main/resources/manual.xml | 75 +++++++++++++++++- 7 files changed, 235 insertions(+), 6 deletions(-) create mode 100644 jOOQ-website/robots.txt diff --git a/jOOQ-website/contribute.php b/jOOQ-website/contribute.php index 5a709e6d9b..c482680bd5 100644 --- a/jOOQ-website/contribute.php +++ b/jOOQ-website/contribute.php @@ -1,7 +1,7 @@ Become a jOOQer'; + print 'Be a part of jOOQ! Become a jOOQer'; } function getSlogan() { return "jOOQ can only be as great as its community. You can make the change happen! jOOQ needs @@ -18,7 +18,7 @@ function printContent() {

Overview

@@ -1604,7 +1604,81 @@ org.jooq.util.GenerationTool /jooq-config.properties generatortargetpackage="org.jooq.test.generatedclasses" generatortargetdirectory="${basedir}/src"/> </target> + + +

Integrate generation with Maven

+

Using the official jOOQ-codegen-maven plugin, you can integrate + source code generation in your Maven build process:

+
+<plugin>
+
+  <!-- Specify the maven code generator plugin -->
+  <groupId>org.jooq</groupId>
+  <artifactId>jooq-codegen-maven</artifactId>
+  <version>1.6.7</version>
+  
+  <!-- The plugin should hook into the generate goal -->
+  <executions>
+    <execution>
+      <goals>
+        <goal>generate</goal>
+      </goals>
+    </execution>
+  </executions>
+  
+  <!-- Manage the plugin's dependency. In this example, we'll use a Postgres database -->
+  <dependencies>
+    <dependency>
+      <groupId>postgresql</groupId>
+      <artifactId>postgresql</artifactId>
+      <version>8.4-702.jdbc4</version>
+    </dependency>
+  </dependencies>
+  
+  <!-- Specify the plugin configuration -->
+  <configuration>
+  
+    <!-- JDBC connection parameters -->
+    <jdbc>
+      <driver>org.postgresql.Driver</driver>
+      <url>jdbc:postgresql:postgres</url>
+      <schema>public</schema>
+      <user>postgres</user>
+      <password>test</password>
+    </jdbc>
+    
+    <!-- Generator parameters -->
+    <generator>
+      <name>org.jooq.util.DefaultGenerator</name>
+      <database>
+        <name>org.jooq.util.postgres.PostgresDatabase</name>
+        <includes>.*</includes>
+        <excludes></excludes>
+      </database>
+      <generate>
+        <relations>true</relations>
+        <deprecated>false</deprecated>
+      </generate>
+      <target>
+        <packageName>org.jooq.util.maven.example</packageName>
+        <directory>target/generated-sources/jooq</directory>
+      </target>
+      <masterDataTables>
+        <masterDataTable>
+          <name>t_language</name>
+          <literal>cd</literal>
+          <description>description</description>
+        </masterDataTable>
+      </masterDataTables>
+    </generator>
+  </configuration>
+</plugin>
+
+

See the full example of a pom.xml including the jOOQ-codegen artefact here: + https://github.com/lukaseder/jOOQ/blob/master/jOOQ-codegen-maven-example/pom.xml +

+

Use jOOQ generated classes in your application

Be sure, both jOOQ.jar and your generated package (see configuration) are located on your classpath. Once this is done, you diff --git a/jOOQ-website/manual/META/Configuration/index.php b/jOOQ-website/manual/META/Configuration/index.php index a214beb802..db3538d3ec 100644 --- a/jOOQ-website/manual/META/Configuration/index.php +++ b/jOOQ-website/manual/META/Configuration/index.php @@ -212,7 +212,81 @@ org.jooq.util.GenerationTool /jooq-config.properties generatortargetpackage="org.jooq.test.generatedclasses" generatortargetdirectory="${basedir}/src"/> </target> + + +

Integrate generation with Maven

+

Using the official jOOQ-codegen-maven plugin, you can integrate + source code generation in your Maven build process:

+
+<plugin>
+
+  <!-- Specify the maven code generator plugin -->
+  <groupId>org.jooq</groupId>
+  <artifactId>jooq-codegen-maven</artifactId>
+  <version>1.6.7</version>
+  
+  <!-- The plugin should hook into the generate goal -->
+  <executions>
+    <execution>
+      <goals>
+        <goal>generate</goal>
+      </goals>
+    </execution>
+  </executions>
+  
+  <!-- Manage the plugin's dependency. In this example, we'll use a Postgres database -->
+  <dependencies>
+    <dependency>
+      <groupId>postgresql</groupId>
+      <artifactId>postgresql</artifactId>
+      <version>8.4-702.jdbc4</version>
+    </dependency>
+  </dependencies>
+  
+  <!-- Specify the plugin configuration -->
+  <configuration>
+  
+    <!-- JDBC connection parameters -->
+    <jdbc>
+      <driver>org.postgresql.Driver</driver>
+      <url>jdbc:postgresql:postgres</url>
+      <schema>public</schema>
+      <user>postgres</user>
+      <password>test</password>
+    </jdbc>
+    
+    <!-- Generator parameters -->
+    <generator>
+      <name>org.jooq.util.DefaultGenerator</name>
+      <database>
+        <name>org.jooq.util.postgres.PostgresDatabase</name>
+        <includes>.*</includes>
+        <excludes></excludes>
+      </database>
+      <generate>
+        <relations>true</relations>
+        <deprecated>false</deprecated>
+      </generate>
+      <target>
+        <packageName>org.jooq.util.maven.example</packageName>
+        <directory>target/generated-sources/jooq</directory>
+      </target>
+      <masterDataTables>
+        <masterDataTable>
+          <name>t_language</name>
+          <literal>cd</literal>
+          <description>description</description>
+        </masterDataTable>
+      </masterDataTables>
+    </generator>
+  </configuration>
+</plugin>
+
+

See the full example of a pom.xml including the jOOQ-codegen artefact here: + https://github.com/lukaseder/jOOQ/blob/master/jOOQ-codegen-maven-example/pom.xml +

+

Use jOOQ generated classes in your application

Be sure, both jOOQ.jar and your generated package (see configuration) are located on your classpath. Once this is done, you diff --git a/jOOQ-website/manual/index.php b/jOOQ-website/manual/index.php index 8ea524efcb..c56b087efd 100644 --- a/jOOQ-website/manual/index.php +++ b/jOOQ-website/manual/index.php @@ -34,7 +34,7 @@ function printContent() { A multi-paged HTML manual -

  • A downloadable PDF manual
  • +
  • A downloadable PDF manual (coming soon)
  • Overview

    diff --git a/jOOQ-website/robots.txt b/jOOQ-website/robots.txt new file mode 100644 index 0000000000..bc1164092c --- /dev/null +++ b/jOOQ-website/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +Allow: / + diff --git a/jOOQ-website/src/main/resources/manual.xml b/jOOQ-website/src/main/resources/manual.xml index 624754542c..c982402996 100644 --- a/jOOQ-website/src/main/resources/manual.xml +++ b/jOOQ-website/src/main/resources/manual.xml @@ -11,7 +11,7 @@

    Overview

    This manual is divided into four main sections:

    @@ -1410,7 +1410,80 @@ org.jooq.util.GenerationTool /jooq-config.properties generatortargetpackage="org.jooq.test.generatedclasses" generatortargetdirectory="${basedir}/src"/> </target> + + +

    Integrate generation with Maven

    +

    Using the official jOOQ-codegen-maven plugin, you can integrate + source code generation in your Maven build process:

    + + + + org.jooq + jooq-codegen-maven + 1.6.7 + + + + + + generate + + + + + + + + postgresql + postgresql + 8.4-702.jdbc4 + + + + + + + + + org.postgresql.Driver + jdbc:postgresql:postgres + public + postgres + test + + + + + org.jooq.util.DefaultGenerator + + org.jooq.util.postgres.PostgresDatabase + .* + + + + true + false + + + org.jooq.util.maven.example + target/generated-sources/jooq + + + + t_language + cd + description + + + + + +]]> +

    See the full example of a pom.xml including the jOOQ-codegen artefact here: + https://github.com/lukaseder/jOOQ/blob/master/jOOQ-codegen-maven-example/pom.xml

    +

    Use jOOQ generated classes in your application

    Be sure, both jOOQ.jar and your generated package (see configuration) are located on your classpath. Once this is done, you