jooq/jOOQ-codegen-gradle/README.md
Ben Manes 9f160d5e86 Contribute Gradle plugin
Contributing the [Gradle plugin](https://github.com/ben-manes/gradle-jooq-plugin) required,
 - Updating to the package names
 - Adding to the Maven build. The Gradle plugin dependencies piggyback
   on Flyway's repository, as Gradle does not officially publish the
   dependencies for building plugins in another build tool.
 - Assigning copyright

This contribution is not tested due to a broader build failure in
`FlashbackTable`.

Note that this plugin took a simple and fast approach by leveraging
Groovy's XML markeup syntax. This provided a concise extension, at
the cost of flexibility to customize the plugin in multiple build
scripts (e.g. subproject adding data type converters). A richer
plugin should be created, but exceeded the scope of what was needed
at the time of development.
2013-08-26 03:05:05 -07:00

49 lines
1.1 KiB
Markdown

# Gradle jOOQ Plugin
[jOOQ](http://www.jooq.org) generates a simple Java representation of your database schema.
Every table, view, stored procedure, enum, UDT is a class. This plugin performs code generation
as part of the Gradle build.
## Usage
This plugin is hosted on the Maven Central Repository. All actions are logged at the `info` level.
The configuration is defined as an XML DSL based on jOOQ's
[codegen schema](http://www.jooq.org/xsd/jooq-codegen-3.0.0.xsd). The default target directory is
updated to reflect Gradle's build directory (`build/generated-sources/jooq`).
```groovy
apply plugin: 'jooq'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jooq:jooq-codegen-gradle:${versions.jOOQ}"
}
}
jooq {
jdbc {
url 'jdbc:mysql://localhost:3306'
driver 'com.mysql.jdbc.Driver'
user 'root'
}
generator {
database {
name 'org.jooq.util.mysql.MySQLDatabase'
inputSchema 'example'
includes '.*'
}
}
}
```
## Tasks
### `generateJooq`
Executes the jOOQ [code generator](http://www.jooq.org/doc/3.0/manual/code-generation/).