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.

4

3 回答 3

0

我花了一些时间,但最后我找到了一个适合我的组合: 可能最重要的事情是两者兼而有之:定义 xjcArg: -Xannotate 并在插件中定义对 org.jvnet.jaxb2_commons:jaxb2-basics-annotate 的依赖关系定义。

于 2020-02-12T14:07:37.703 回答
0

您可以将 -X 标志设置xjcArgsargs

 <xjcArgs>
    <xjcArg>-Xannotate</xjcArg>
 </xjcArgs>
于 2017-07-20T11:25:19.557 回答
0

我在这里找到了解决方案。通过添加-Dcom.sun.tools.xjc.XJCFacade.nohack=true系统属性,我能够解决问题。

于 2018-12-29T09:46:43.803 回答