jooq不生成

voase2hg  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(425)

我跟在这里。我曾经 postgresql 而不是 h2 . 我可以用一些额外的字段来构建这个项目。
我创建了一个包 database 低于 com.example.demo ,但项目建成后仍然是空的。
内部版本.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)
    }
}

有什么我不知道的吗?为什么我看不到波乔和道斯 database 包裹?我的数据库只有一个表和两列。 BUILD SUCCESSFULL 我打字的时候 ./gradlew generate ,但没有生成任何内容。

6yjfywim

6yjfywim1#

你的档案看起来不错。我有一个类似的问题(在使用maven时)。尝试三件事(对我有效):
在“withinputschema”属性中检查架构的大小写。尽量把大写字母传给公众。
尝试将“src/main/java”更改为“./src/main/java”
在其中添加“includes”和pass.*(为架构中的所有表生成)

相关问题