javajax-ws-customizationjaxws-maven-plugin

jaxb2-basics-annotate with jaxws-maven-plugin configuration


I have a maven configuration using the jaxws-maven-plugin to generate the class files from the wsdl.

I am trying to get the jaxb2-basics-annotate plugin to work with the generation to allow me to add some annotations to the generated output.

The specific plugin configuration is:

   <pluginManagement>
        <plugins>
            <plugin>
                <!-- This is the WSIMPORT plugin used to generate code from WSDL -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <!-- Keep generated files -->
                    <keep>true</keep>
                    <!-- generated source files destination-->
                    <sourceDestDir>target/generated-sources</sourceDestDir>
                    <!-- this is so the xsd files can be accessed -->
                    <vmArgs>
                        <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
                    </vmArgs>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

...

           <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <dependencies>
                <dependency>
                    <groupId>org.jvnet.jaxb2_commons</groupId>
                    <artifactId>jaxb2-basics-annotate</artifactId>
                    <version>1.0.2</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>travel-itinerary</id>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <extension>true</extension>
                        <!--<args>-->
                            <!--<arg>-Xannotate</arg>-->
                        <!--</args>-->

When I have the args commented out I get the following error:

[ERROR] Using "http://annox.dev.java.net" customizations requires the "-Xannotate" switch to enable this plug-in.

When I have the args being used I get the following error message:

unrecognized parameter -Xannotate

Usage: wsimport [options]

where [options] include:

I would greatly appreciate if someone could fill in the gap in my configuration to get the annotation plugin working with the jaxws-maven-plugin.


Solution

  • You might set the -X Flags to xjcArgs insteadt of args

     <xjcArgs>
        <xjcArg>-Xannotate</xjcArg>
     </xjcArgs>