diff --git a/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java b/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java index e7d6ca58f8..dab5a67704 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java +++ b/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java @@ -248,10 +248,14 @@ public class GenerationTool { Database database = databaseClass.newInstance(); List schemata = d.getSchemata(); + + // For convenience and backwards-compatibility, the schema configuration can be set also directly + // in the element if (schemata.isEmpty()) { Schema schema = new Schema(); schema.setInputSchema(trim(d.getInputSchema())); schema.setOutputSchema(trim(d.getOutputSchema())); + schema.setOutputSchemaToDefault(d.isOutputSchemaToDefault()); schemata.add(schema); } else { @@ -272,7 +276,19 @@ public class GenerationTool { schema.setInputSchema(trim(j.getSchema())); } - if (schema.getOutputSchema() == null) { + // [#3018] Prior to , empty elements meant that + // the outputSchema should be the default schema. This is a bit too clever, and doesn't + // work when Maven parses the XML configurations. + if ("".equals(schema.getOutputSchema())) { + log.warn("WARNING: Empty should no longer be used to model default outputSchemas. Use true, instead. See also: https://github.com/jOOQ/jOOQ/issues/3018"); + } + + // [#3018] If users want the output schema to be "" then, ignore the actual configuration + if (TRUE.equals(schema.isOutputSchemaToDefault())) { + schema.setOutputSchema(""); + } + + else if (schema.getOutputSchema() == null) { schema.setOutputSchema(trim(schema.getInputSchema())); } diff --git a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.4.0.xsd b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.4.0.xsd index ffa2eb7813..143791a032 100644 --- a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.4.0.xsd +++ b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.4.0.xsd @@ -410,9 +410,17 @@ production schema. Use this to override your local development schema name for source code generation. If not specified, this will be the same as the input-schema. + + This will be ignored if outputSchemaToDefault is set to true --> + + + + + + diff --git a/jOOQ-test/pom.xml b/jOOQ-test/pom.xml index 944b34a8d0..f5c955a0d2 100644 --- a/jOOQ-test/pom.xml +++ b/jOOQ-test/pom.xml @@ -4376,8 +4376,9 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxx + xxxx xxxxxxx xxxx xx xxxxxxxxxxx xx xxxxx xxx xxxxxx xxxxxxxxxxxxxxxxxx xx xxxxxx xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx @@ -4388,7 +4389,10 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx + xxxx + xxxxxxx xxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxx xx xxxxxxxxxx xxx xxx xxxxx xxxx xxxxxxxx xxx xxxxxxxxxxxxx xxx xxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxx