Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using <matchers/> with <schemas/> in Maven code generation #7418

Closed
lukaseder opened this issue Apr 16, 2018 · 4 comments
Closed

Comments

@lukaseder
Copy link
Member

lukaseder commented Apr 16, 2018

When using <matchers/> in the Maven code generation, specifying <schemas/> doesn't work. The build fails with the following error:

[ERROR] Failed to execute goal org.jooq.trial:jooq-codegen-maven:3.11.0-SNAPSHOT:generate (generate-h2-matchers) on project jooq-test: Unable to parse configuration of mojo org.jooq.trial:jooq-codegen-maven:3.11.0-SNAPSHOT:generate for parameter schemaIdentifier: Cannot find 'schemaIdentifier' in class org.jooq.util.jaxb.Schema -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigurationException

I.e. there are two conflicting Schema types, which Maven doesn't seem to be able to distinguish...

@cpf624
Copy link

cpf624 commented Jul 10, 2018

I use 3.11.2 also got this error.

<configuration>
    <generator>
        <name>org.jooq.codegen.JavaGenerator</name>
        <strategy>
            <matchers>
                <schemas>
                    <schema>
                        <expression>^xhome_xbag_(.*)$</expression>
                        <schemaClass>
                            <transform>PASCAL</transform>
                            <expression>$1_DB</expression>
                        </schemaClass>
                        <schemaIdentifier>
                            <transform>UPPER</transform>
                            <expression>DB_$1</expression>
                        </schemaIdentifier>
                    </schema>
                </schemas>
            </matchers>
        </strategy>
    </generator>
</configuration>
Unable to parse configuration of mojo org.jooq:jooq-codegen-maven:3.11.2:generate for parameter expression: Cannot find 'expression' in class org.jooq.meta.jaxb.Schema

@lukaseder
Copy link
Member Author

Looking into this, this seems to be a bug in the maven plugin plugin. Will investigate and report issues to Maven accordingly. Doesn't really look as though there's a workaround right now, short of using standalone code generation or programmatic code generation configurations :-/

@lukaseder
Copy link
Member Author

This seems to be how the maven plugin architecture works, unfortunately. There's a Schema class in the relevant package that backs the XML content, and thus that specific class is preferred. But in general, when using XML lists in Maven, the list element name is irrelevant, so you can replace <schema> by anything, including e.g. <xyz>. This should work:

<configuration>
    <generator>
        <name>org.jooq.codegen.JavaGenerator</name>
        <strategy>
            <matchers>
                <schemas>
                    <xyz>
                        <expression>^xhome_xbag_(.*)$</expression>
                        <schemaClass>
                            <transform>PASCAL</transform>
                            <expression>$1_DB</expression>
                        </schemaClass>
                        <schemaIdentifier>
                            <transform>UPPER</transform>
                            <expression>DB_$1</expression>
                        </schemaIdentifier>
                    </xyz>
                </schemas>
            </matchers>
        </strategy>
    </generator>
</configuration>

@lukaseder
Copy link
Member Author

Fixed through #7747 with incompatible change 7373ad1

Due to the incompatible nature of the change, and given the workaround shown here #7418 (comment), this fix will not be merged to jOOQ 3.11 or older versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants