0

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.

sweetfa
  • 5,457
  • 2
  • 48
  • 62

3 Answers3

1

It took me some time but finally I found a combination which works for me: Probably the most important thing is to do both: define xjcArg: -Xannotate and define the dependency to org.jvnet.jaxb2_commons:jaxb2-basics-annotate within the plugin definition.

0

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

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

I found the solution here. By adding the -Dcom.sun.tools.xjc.XJCFacade.nohack=true system property, I was able to resolve the issue.

Seva Safris
  • 401
  • 4
  • 12