Hi Rob,

jOOQ's GenerationTool deletes all non-jOOQ content in
src/main/java/com/skatr/db/gen (i.e. directory/packageName). It doesn't
touch anything else.

You could tell the generator to not do the above by specifying

target {
  // ..
  clean = false
}

See:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-target/

But I'm assuming that things are cleaned by some other process, including
the gradle plugin or gradle itself?

On Fri, Jan 28, 2022 at 5:41 AM Rob Sargent <[email protected]> wrote:

> Near as I can tell in my jooq/gradle/java17 setup on a mac11.6.2 a call to
> generatJooq is dropping all the java files, including the application
> files, then generating the database classes.  This is rather troubling.
> First spotted on version 3.14, I’ve moved all my dependencies forward
> including vaadin 22 (which is giving me a separate set of troubles)
>
> Here’s my jooq/gradle block.
>
> jooq {
>   version = '3.15.+'
>   edition = nu.studer.gradle.jooq.JooqEdition.OSS  // the default (can be
> omitted)
>   dependencies {
>     jooqGenerator 'org.postgresql:postgresql:42.2.14'
>   }
>   configurations {
>     if (referenceDBname.contains("DBNAME_NOT_SET")) {
>       println("HEADS UP: you will need to configure the reference
> database: " + referenceDBname)
>     }
>     else {
>       println("Generating jOOQ code from " + referenceDBname)
>     }
>     main {  // name of the jOOQ configuration
>           generateSchemaSourceOnCompilation = ! referenceDBname ==
> 'DBNAME_NOT_SET'  // default (can be omitted)
>           generationTool
>           {
>         logging = org.jooq.meta.jaxb.Logging.INFO
>         jdbc {
>           driver = 'org.postgresql.Driver'
>  url = String.format("jdbc:postgresql://%s:%s/%s", referenceDBhost,
> referenceDBport, referenceDBname)
>           user = 'postgres'
>  if (project.hasProperty("referenceDBpswd")) {
>             password = referenceDBpswd
>  }
>  else {
>    println "No dbpwd"
>  }
>         }
>         generator {
>  database {
>    // forcedTypes {
>    //   forcedType {
>    //     userType = 'java.util.LocalDateTime'
>    //     converter = 'com.skatr.tsn.util.DateTimeConverter'
>    //     includeExpression = '.*timestamp.*'
>    //   }
>    // }
>    name = 'org.jooq.meta.postgres.PostgresDatabase'
>    schemaVersionProvider = 'select max(version::int) FROM
> public.flyway_schema_history'
>    includeRoutines = true
>    schemata {
>      schema {
> inputSchema = 'public'
>      }
>      schema {
> inputSchema = 'suas'
>      }
>    }
>  }
>           generate {
>             deprecated               = false
>             fluentSetters            = true
>             generatedAnnotation      = true
>             generatedAnnotationType  = 'DETECT_FROM_JDK'
>             globalRoutineReferences  = true
>             immutablePojos           = false
>             pojos                    = true
>             records                  = true
>             relations                = true
>             routines                 = true
>           }
>           target {
>    packageName = 'com.skatr.db.gen'
>    directory = 'src/main/java'
>  }
>           strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy'
>         }
>       }
>     }
>   }
> }
>
> tasks.named('generateJooq').configure {
>   // make jOOQ task participate in incremental builds (which is also a
> prerequisite for participating in build caching)
>   allInputsDeclared = true
>   // make jOOQ task participate in build caching
>   outputs.cacheIf { true }
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/E82216FC-1902-422E-84AE-EAF10F4EE0D4%40gmail.com
> <https://groups.google.com/d/msgid/jooq-user/E82216FC-1902-422E-84AE-EAF10F4EE0D4%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO5GYYtDcsTtrT_qRfu4QuDhbsh5J2S7otcSOYx5JeMD6Q%40mail.gmail.com.

Reply via email to