GithubHelp home page GithubHelp logo

jooq-codegen's Introduction

Jooq GenerationTool as Java Annotation Processor

It's a simple Java Annotation Processor wrapper over GenerationTool Download


To use in gradle do following steps:

  • Create DDL, for example sample.ddl:
create table if not exists someschema.pnl_run(
    id bigint not null,
    note varchar(3) not null,

    primary key(id)
);
  • Create GenerationTool configuration, for example jooq.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd">
    <generator>
        <database>
            <name>org.jooq.meta.extensions.ddl.DDLDatabase</name>
            <includes>.*</includes>
            <includeSystemIndexes>true</includeSystemIndexes>
            <properties>
                <property>
                    <key>defaultNameCase</key>
                    <value>lower</value>
                </property>
                <property>
                    <key>scripts</key>
                    <value>*.ddl</value>
                </property>
            </properties>
        </database>
        <generate>
            <daos>true</daos>
            <generatedAnnotation>true</generatedAnnotation>
            <fluentSetters>true</fluentSetters>
            <pojos>true</pojos>
        </generate>
        <target>
            <packageName>some.package</packageName>
            <directory>.</directory>
        </target>
    </generator>
</configuration>
  • Add gradle task into build.gradle and pass 2 options to configure processor:
task jooqCodegen(type: JavaCompile, group: 'build') {
    classpath = configurations.compileClasspath
    destinationDir = project.file('src/generated')
    options.compilerArgs = [
            "-proc:only",
            "-AgenerationToolRunner.baseDir=" + projectDir.path + "/src/main/META-INF",
            "-AgenerationToolRunner.configurationFile=" + projectDir.path + "/src/main/META-INF/jooq.xml",
            "-processor", "com.rbm.jooq.GenerationToolRunnerProcessor",
            "-Xmaxerrs", "1",
            "-Xmaxwarns", "1"
    ]
}
  • Somehow add dependency on created task:
compileJava {
    dependsOn {
        [
            jooqCodegen
        ]
    }
}

jooq-codegen's People

Contributors

xnike avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.