Skip the Generated on… in Java files using jaxb2 maven plugin

▼魔方 西西 提交于 2019-12-23 07:57:22

问题


I'd like to get the maven-jaxb2-plugin to do not write the 'disclaimer':

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 

At least the timestamp.

Thank you.

Udo.


回答1:


Use -no-header if you use command line source generator or header='false' if you use ant.

In the pom, in configuration <args><arg>-no-header</arg></args>




回答2:


Just to add, I use Maven and what worked for me was:

<arguments>-no-header</arguments> 



回答3:


use "noGeneratedHeaderComments" example:

            <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>  


来源:https://stackoverflow.com/questions/6899256/skip-the-generated-on-in-java-files-using-jaxb2-maven-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!