Andrew Rueckert Andrew Rueckert - 5 months ago 12
Java Question

Maven Unable to parse configuration of mojo - wrong class

Maven appears to be attempting to serialize my configuration into the wrong class, and I'm not sure whether the bug is in maven, the generator library, or my own configuration.

I've got the following XML snippet in my plugin configuration: (see documentation, trying to work around this bug)

<generator>
<strategy>
<matchers>
<schemas>
<schema>
<schemaClass>
<transform>PASCAL</transform>
<expression>SCHEMA_$0</expression>
</schemaClass>
<schemaIdentifier>
<transform>PASCAL</transform>
<expression>SCHEMA_$0</expression>
</schemaIdentifier>
</schema>
</schemas>
</matchers>
</strategy>
</generator>


and get the following error when I try to build:


[ERROR] Failed to execute goal org.jooq:jooq-codegen-maven:3.8.1:generate (default) on project my-project: Unable to parse configuration of mojo org.jooq:jooq-codegen-maven:3.8.1:generate for parameter schemaClass: Cannot find 'schemaClass' in class org.jooq.util.jaxb.Schema -> [Help 1]


org.jooq.util.jaxb.Schema
doesn't have a schemaClass property, but the object inside matchers -> schemas should be of type
org.jooq.util.jaxb.MatchersSchemaType
according to the schema xsd and the generated-code.

What's going on here? Whose responsibility is it to deserialize this class correctly - maven, jooq, or something else?

Answer

I can't believe that I didn't think of this sooner; I got it working with:

<generator>
    <strategy>
        <matchers>
            <schemas>
                <matchersSchemaType>
                    <schemaClass>
                        <transform>PASCAL</transform>
                        <expression>SCHEMA_$0</expression>
                    </schemaClass>
                    <schemaIdentifier>
                        <transform>PASCAL</transform>
                        <expression>SCHEMA_$0</expression>
                    </schemaIdentifier>
                </matchersSchemaType>
            </schemas>
        </matchers>
    </strategy>
</generator>