Hi all,

I have written a jooq-codegen maven plugin. It's in fact just a small
wrapper around the GenerationTool class, that allows you to run the
jOOQ code generation process during Maven's "generate-sources" phase,
which is meant for these kind of things.

I tried to do this without writing a dedicated plugin (using exec-
maven-plugin) first but this is doesn't work because jOOQ as well as
log4j look for their properties files in the classpath, and maven
doesn't give plugins access to the project's resources.

If anyone else is interested in this kind of functionality, maybe we
could turn this (or something based on it) into an "official" jooq
plugin?

I have put the source of the current version of the plugin online at
http://www.oele.net/jooq-maven-plugin.zip .

config example:

<plugin>
    <groupId>nl.seeas</groupId>
    <artifactId>jooqMavenPlugin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>8.4-702.jdbc4</version>
        </dependency>
    </dependencies>
    <configuration>
        <jdbc>
            <driver>org.postgresql.Driver</driver>
            <url>jdbc:postgresql://localhost/yourmuze_com</url>
            <schema>public</schema>
            <user>yourmuze_com</user>
            <password>blabla</password>
        </jdbc>
        <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>com.yourmuze.web.db</packageName>
                <directory>target/generated-sources/jooq</directory>
            </target>
            <masterDataTables>
                <masterDataTable>
                    <name>customer_type</name>
                    <literal>name</literal>
                    <description>description</description>
                </masterDataTable>
            </masterDataTables>
        </generator>
    </configuration>
</plugin>


BTW, congratulations on the new website! :) One small thing: on
Firefox on linux on the first text block ("SQL was never meant ..")
the bottom border strikes through the last line of text...

Sander

Reply via email to