Skip the Generated on... in Java files using jaxb2 maven plugin
Asked Answered
S

3

10

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.

Sapphire answered 1/8, 2011 at 13:40 Comment(0)
M
9

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>

Molli answered 1/8, 2011 at 14:10 Comment(2)
Add to your answer that in the pom, in configuration <args><arg>-no-header</arg></args>Sapphire
Exactly what I was looking for. This site is really excellent!Calamint
H
9

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

<arguments>-no-header</arguments> 
Here answered 17/7, 2012 at 18:13 Comment(1)
works with <groupId>org.codehaus.mojo</groupId><artifactId>jaxb2-maven-plugin</artifactId><version>1.5</version>Honeycomb
A
7

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>  
Anaconda answered 24/5, 2015 at 20:15 Comment(2)
you should not generate sources into the source directory. Instead generate them into the target directory. Maven will pickup both.Maurizio
@matthiasB you're right the "outputDirectory" parameter should be removed..Anaconda

© 2022 - 2024 — McMap. All rights reserved.