I was following here. I used postgresql
instead of h2
. I was able to build the project with some additional fields.
I created a package database
under com.example.demo
, but it was still empty after project was built.
build.gradle:
buildscript {
ext {
springBootVersion = '2.4.2'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'org.jooq:jooq-codegen:3.14.4'
classpath 'org.postgresql:postgresql:42.2.18'
}
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '15'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-jooq'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.flywaydb:flyway-core'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
import org.jooq.codegen.GenerationTool
import org.jooq.meta.jaxb.*
task generate {
def configuration = new Configuration()
configuration
.withJdbc(new Jdbc()
.withDriver('org.postgresql.Driver')
.withUrl('jdbc:postgresql://localhost:5432/vertx')
.withUser('postgres')
.withPassword('postgres'))
.withGenerator(new Generator()
.withDatabase(new Database().withInputSchema('public'))
.withGenerate(new Generate()
.withPojos(true)
.withDaos(true))
.withTarget(new Target()
.withPackageName('com.example.demo.database')
.withDirectory('src/main/java')))
doLast {
GenerationTool.generate(configuration)
}
}
Is there something I am missing? Why can I not see pojos and daos in database
package? My database has only one table with 2 columns.
BUILD SUCCESSFULL
when I type ./gradlew generate
, but nothing gets generated.
question from:
https://stackoverflow.com/questions/65871226/jooq-doesnt-generate 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…