gradle-jooq-plugin icon indicating copy to clipboard operation
gradle-jooq-plugin copied to clipboard

Combination of setup-gradle github action with cache and gradle-jooq-plugin leads to "Unresolved reference"

Open mrclrchtr opened this issue 1 year ago • 0 comments

Hi, first of all, thank you very much for the plugin!

I use the plugin and setup-gradle in combination.

I have configured the plugin as follows:

jooq {
  configurations {
    create("main") {
      jooqConfiguration.apply {
        logging = org.jooq.meta.jaxb.Logging.WARN
        jdbc.apply {
          driver = "org.postgresql.Driver"
          url = "jdbc:postgresql://localhost:54320/service"
          user = "service"
          password = "password"
        }
        generator.apply {
          name = "org.jooq.codegen.KotlinGenerator"
          database.apply {
            name = "org.jooq.meta.postgres.PostgresDatabase"
            inputSchema = "public"
          }
          target.apply {
            packageName = "de.mrclrchtr.generated.persistence.entities"
          }
          strategy.apply {
            name = "org.jooq.codegen.DefaultGeneratorStrategy"
            matchers = Matchers().withTables(
              MatchersTableType().withTableClass(
                MatcherRule()
                  .withTransform(MatcherTransformType.PASCAL)
                  .withExpression("\$0_TABLE")
              )
            )
          }
          generate.apply {
            isKotlinNotNullRecordAttributes = true
            isGeneratedAnnotation = true
            indentation = "\\s\\s"
            isSequences = true
          }
        }
      }
    }
  }
}

tasks.named<JooqGenerate>("generateJooq") {
    // Run the Flyway migration before generating the jOOQ sources
    dependsOn(":infrastructure:flywayComposeUp")

    // Make jOOQ task participate in incremental builds (and build caching)
    allInputsDeclared.set(true)

    // Declare Flyway migration scripts as inputs on the jOOQ task
    inputs.files(fileTree("$projectDir/src/main/resources/db/migration"))
      .withPropertyName("migrations")
      .withPathSensitivity(PathSensitivity.RELATIVE)
  }

In the pipeline I get: Task :service:generateJooq FROM-CACHE

and then many errors of this type:

> Task :holz-service:compileKotlin FAILED
e: file:///home/runner/_work/service/src/main/kotlin/de/***/domain/Service.kt:5:26 Unresolved reference: generated

So not even the package generated was pulled from the cache.

What could be the reason? This should actually work, right?

Thank you very much for your help!

mrclrchtr avatar Feb 18 '24 22:02 mrclrchtr