Search code examples
javajaxbxjcmaven-jaxb2-plugin

JAXB: How to generate English Javadoc


When I generate JAXB classes using the maven-jaxb2-plugin I get classes with partial(!?) German Javadoc. (My default locale: de_CH)

What I want: English Javadoc

I tried to set the maven opts: -Duser.language=en -Duser.country=US but it had no effect.

How can I generate JAXB classes with English Javadoc?

Here is the Javadoc for some JAXB classes with partial German Javadoc: http://drombler.sourceforge.net/DromblerACP/docs/site/0.2.1-SNAPSHOT/apidocs/org/drombler/acp/core/action/jaxb/package-frame.html

Here is the according XSD: http://sourceforge.net/p/drombler/drombler-acp/ci/default/tree/drombler-acp-core-action/src/main/resources/actions.xsd

Here is the according POM: http://sourceforge.net/p/drombler/drombler-acp/ci/default/tree/drombler-acp-core-action/pom.xml

Related JAXB Issue:

https://java.net/jira/browse/JAXB-1001

Any workaround?


Solution

  • You can pass arbitrary properties to XJC using the args/arg element in the configuration of the maven-jaxb2-plugin:

    <configuration>
        <extension>true</extension>
        <args>
            <arg>-Duser.language=en</arg>
        </args>
    </configuration>
    

    These arguments will be just passed to XJC.

    However I have no idea if -Duser.language=en -Duser.country=US are the right options. Anyway the args/arg will be passed to XJC. If it does not work please file an issue here.

    Disclaimer: I'm the author of maven-jaxb2-plugin.

    Update

    This feature is implemented in the version 0.10.0. Now you can do the following:

            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <configuration>
                    <locale>es</locale>
                </configuration>
            </plugin>