使用jaxb2 maven插件在Java文件中跳过Generated on ...

时间:2011-08-01 13:40:58

标签: java jaxb jaxb2 maven-jaxb2-plugin

我想让maven-jaxb2-plugin不要写'免责声明':

This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.2-hudson-jaxb-ri-2.2-63- 
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
Any modifications to this file will be lost upon recompilation of the source schema. 
Generated on: 2011.08.01 at 09:20:43 AM CEST 

至少是时间戳。

谢谢。

3 个答案:

答案 0 :(得分:8)

如果使用命令行源生成器,请使用-no-header;如果使用ant,请使用header='false'

在pom中,在配置<args><arg>-no-header</arg></args>

答案 1 :(得分:8)

添加,我使用Maven,对我有用的是:

<arguments>-no-header</arguments> 

答案 2 :(得分:4)

使用&#34; noGeneratedHeaderComments&#34; 例如:

            <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
                <clearOutputDir>false</clearOutputDir>
                <sources>
                    <source>${project.basedir}/src/main/resources/xsd</source>
                </sources>      
                <noGeneratedHeaderComments>true</noGeneratedHeaderComments>
            </configuration>
        </plugin>