4

I have a postgres:13.5-alpine database running and set up jOOQ like so:

versions

plugin_jooq=7.1.1
lib_jooq=3.16.6

gradle

plugins {
    id 'nu.studer.jooq' version "${plugin_jooq}"
}

dependencies {
    api "org.postgresql:postgresql"

    implementation "org.jooq:jooq:${lib_jooq}"
    implementation "org.jooq:jooq-meta:${lib_jooq}"
    implementation "org.jooq:jooq-codegen:${lib_jooq}"
}

jooq {
    version = "${lib_jooq}"
    edition = nu.studer.gradle.jooq.JooqEdition.OSS

    configurations {
        mydb {
            generateSchemaSourceOnCompilation = true

            generationTool {
                logging = org.jooq.meta.jaxb.Logging.WARN
                jdbc {
                    driver = 'org.postgresql.Driver'
                    url = 'jdbc:postgresql://localhost:5432/mydb'
                    user = '<username>'
                    password = '<password>'
                    properties {
                        property {
                            key = 'PAGE_SIZE'
                            value = 2048
                        }
                    }
                }
                generator {
                    name = 'org.jooq.codegen.DefaultGenerator'
                    database {
                        name = 'org.jooq.meta.postgres.PostgresDatabase'
                        inputSchema = 'public'
                        includes = '.*'
                        excludes = ''
                    }
                    target {
                        directory = 'build/generated/sources/'
                        packageName = 'my.app.jooq'
                    }
                }
            }
        }
    }
}

build.dependsOn generateMydbJooq

when I run codegen, I get

org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 927; cvc-complex-type.2.4.a:
Invalid content was found starting with element
'{"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeExcludePackageRoutines}'.

One of '{
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":properties, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":regexFlags, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeTables, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeEmbeddables, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeRoutines, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeTriggerRoutines, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includePackages, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includePackageRoutines, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includePackageUDTs, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includePackageConstants, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeUDTs, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeDomains, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeSequences, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeIndexes, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includePrimaryKeys, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeUniqueKeys, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeForeignKeys, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeCheckConstraints, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeSystemIndexes, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeSystemCheckConstraints, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":includeInvisibleColumns, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":recordVersionFields, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":recordTimestampFields, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":syntheticObjects, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":syntheticIdentities, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":syntheticPrimaryKeys, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":overridePrimaryKeys, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":dateAsTimestamp, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":ignoreProcedureReturnValues, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":unsignedTypes, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":integerDisplayWidths, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":inputCatalog, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":outputCatalog, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":outputCatalogToDefault, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":inputSchema, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":outputSchema, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":outputSchemaToDefault, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":catalogs, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":schemata, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":schemaVersionProvider, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":catalogVersionProvider, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":orderProvider, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":embeddables, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":embeddablePrimaryKeys, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":embeddableUniqueKeys, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":embeddableDomains, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":customTypes, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":enumTypes, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":forcedTypes, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":forceIntegerTypesOnZeroScaleDecimals, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":tableValuedFunctions, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":logSlowQueriesAfterSeconds, 
"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":logSlowResultsAfterSeconds
}' is expected.
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 3351; cvc-complex-type.2.4.a: Invalid content was found starting with element
'{"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd":visibilityModifier}'.

One of '{...}' is expected.

How do I resolve this?

UPDATE

Trying to apply @LukasEder's suggestion. Added the buildscript but error persists. Spun up some dependency tree, and these are the only dependencies mentioning jooq:

+--- project :my-app
|    +--- org.jooq:jooq:3.16.6 -> 3.14.15
|    |    +--- org.reactivestreams:reactive-streams:1.0.2 -> 1.0.3
|    |    \--- javax.xml.bind:jaxb-api:2.3.1
|    |         \--- javax.activation:javax.activation-api:1.2.0

|    +--- org.jooq:jooq-meta:3.16.6 -> 3.14.15
|    |    \--- org.jooq:jooq:3.14.15 (*)
|    \--- org.jooq:jooq-codegen:3.16.6 -> 3.14.15
|         +--- org.jooq:jooq:3.14.15 (*)
|         \--- org.jooq:jooq-meta:3.14.15 (*)

UPDATE

Downgrade to 3.14.15 did not resolve this.

User1291
  • 7,664
  • 8
  • 51
  • 108
  • Hi! Did you manage to solve it somehow? – Arsen Nov 07 '22 at 14:42
  • @Arsen Somehow, yes, though I hate to say I didn't write down the resolution, at the time. Let me try to sum up our current setup... (1) group "org.jooq" as a dependency is excluded from the spring boot jooq starter, with jooq being its own dependency, (2) the build script workaround mentioned in Lukas' answer is in place, (3) the workaround from https://github.com/etiennestuder/gradle-jooq-plugin/issues/183 is in place, and I think one of those - or maybe the combination of all - may have had the desired effect. Sorry I cannot be of more help. :( Write the answer down, when you find out. – User1291 Nov 07 '22 at 19:41

1 Answers1

1

The third party code generation plugin you're using seems to be wired towards an older XSD version for your configuration objects. This can have various reasons, not sure why you're running into this, but as per the documentation here: https://github.com/etiennestuder/gradle-jooq-plugin#enforcing-the-jooq-configuration-xml-schema-version

You can enforce an XSD version like this:

buildscript {
    configurations['classpath'].resolutionStrategy.eachDependency {
        if (requested.group == 'org.jooq') {
            useVersion '3.16.6'
        }
    }
}
Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
  • ah, wonders of having a multi-project gradle setup... Thank you. Error persists in spite of the added buildscript. I assume you're right and that's going to be the source, it might take a while, though, before I figure out where and how I can apply your suggestion and accept this answer. xD – User1291 Jun 13 '22 at 09:58
  • @User1291: I figured it might not be the answer to your problem, but it could still be the answer to someone else's problem who stumbles upon this Stack Overflow question... – Lukas Eder Jun 13 '22 at 10:03
  • I don't suppose the dependency tree (see update) tells you more than it does me? If it's all in the same project, the buildscript should take effect, no? – User1291 Jun 13 '22 at 10:08
  • @User1291: I'm sorry, I don't know what might be causing those outdated dependencies. Spring Boot, perhaps? – Lukas Eder Jun 13 '22 at 10:30
  • I've now gotten rid of the downgrade by just letting spring do its thing and choosing that version ... still getting the same error. – User1291 Jun 14 '22 at 07:59