JAXB2 Maven插件无法生成注释或注入代码

时间:2011-09-28 12:43:30

标签: maven-2 jaxb2 maven-jaxb2-plugin

我目前有一个ant任务,可以很好地从xsd和xjb绑定文件生成我的域对象。它根据自定义插件创建注释并在需要的地方注入代码。

现在我正在尝试将所有这些移动到Maven,虽然我可以生成对象,但我无法获取注入或添加注释的代码。我的POM插件条目如下:

<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.0</version>
<executions>
    <execution>
        <goals>
            <goal>generate</goal>
        </goals>
    </execution>
</executions>
<configuration>
    <bindingDirectory>src/main/resources/jaxb/bindings</bindingDirectory>
    <generatePackage>com.noush.web.domain.model.data</generatePackage>
    <extension>true</extension>
    <verbose>true</verbose>
    <args><!-- <arg>-XtoString</arg> -->
        <!-- I want to use commons-lang-plugin to generate toString but this can 
            wait <arg>-Xcommons-lang</arg> <arg>-Xcommons-lang:ToStringStyle=SIMPLE_STYLE</arg> -->
        <arg>-Xannotate</arg>
        <arg>-Xinject-code</arg>
    </args>
    <plugins>
        <plugin>
            <groupId>noush</groupId>
            <artifactId>code-expander-plugin</artifactId>
            <version>1.0</version>
        </plugin>
        <plugin>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics-annotate</artifactId>
            <version>0.6.0</version>
        </plugin>

    </plugins>
</configuration>


 </plugin>

创建对象但没有任何注入的代码或注释。输出没有表明任何错误。

如果有帮助,这是我的工作蚂蚁配置:

 <target name="defineXjcTask">
    <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpathref="xjcLib" />
</target>

<target name="generateJaxb">
    <xjc target="${build.generated}" package="${noushweb.domain.model.jaxb.package}">
        <arg value="-verbose"/>
        <arg value="-extension"/>
        <arg value="-Xcommons-lang"/>
        <arg value="-Xcommons-lang:ToStringStyle=SIMPLE_STYLE"/>
        <arg value="-Xinject-code"/>
        <arg value="-Xannotate"/>
        <schema dir="${build.directory}/jaxb/bindings" includes="${matmWS.mmmws.data.filename}" />
        <binding dir="${build.directory}/jaxb/bindings" includes="${matmWS.mmmws.binding.filename}"/>
        <produces dir="${build.generated}/${noushweb.domain.model.jaxb.package.dir}" includes="**/*.java" />
    </xjc>
</target>

<path id="xjcLib">
    <pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jaxb-xjc.jar" />
    <pathelement location="${ib.dir}/jaxb-ri-2.0.5/lib/jaxb-api.jar" />
    <pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jaxb-impl.jar" />
    <pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/activation.jar" />
    <pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jsr173_1.0_api.jar" />
    <pathelement location="../lib/stax-api-1.0-2.jar" />
    <pathelement location="../lib/jaxb-commons-lang-plugin-2.2.jar" />
    <pathelement location="${lib.dir}/commons-lang-2.4/lib/commons-lang-2.4.jar" />
    <pathelement location="../lib/code-expander-plugin.jar" />
    <pathelement location="../lib/jaxb2-basics-runtime-0.6.0.jar" />
    <pathelement location="../lib/jaxb2-basics-tools-0.6.0.jar" />
    <pathelement location="../lib/jaxb2-basics-annotate-0.6.0.jar" />
    <pathelement location="../lib/annox-0.5.0.jar" />
    <pathelement location="${lib.dir}/axis-1_4/lib/commons-logging-1.0.4.jar" />
    <pathelement location="${lib.dir}/hibernate-validator-4.1.0.Final/hibernate-validator-4.1.0.Final.jar"/>
    <pathelement location="${lib.dir}/hibernate-validator-4.1.0.Final/validation-api-1.0.0.GA.jar"/>
</path>

我想我可以使用antrun类型的设置,但我希望我可以让它工作。

任何想法都会受到欢迎。

由于 Noush

0 个答案:

没有答案