Question

I'm trying to remove the generated date and time from files generated with plugin maven-jaxb2-plugin. Is-it possible?

Part of pom.xml :

<build>
    <plugins>
        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.8.3</version>
            <executions>
                <execution>
                    <id>commun-generate</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <generatePackage>my.package.dest</generatePackage>
                        <generateDirectory>${basedir}/src/main/java/</generateDirectory>
                        <schemaDirectory>${basedir}/src/main/resources/schemas/wsrest</schemaDirectory>
                        <bindingDirectory>${basedir}/src/main/resources/schemas/wsrest</bindingDirectory>
                        <bindingIncludes>
                            <include>bindings.xml</include>
                        </bindingIncludes>
                        <strict>false</strict>
                        <extension>true</extension>
                        <verbose>true</verbose>
                    </configuration>
                </execution>

Begin of a generated file :

        //
    // Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.6 
    // Voir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
    // Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. 
    // Généré le : 2014.03.17 à 09:42:08 AM CET 
    //


    package my.package.dest;
...

I would like to remove this part :

Généré le : 2014.03.17 à 09:42:08 AM CET 

thanks in advance

Clément

Was it helpful?

Solution 3

I found a workaround describe here : Skip the Generated on... in Java files using jaxb2 maven plugin

Solution? add in pom.xml, in , theses arguments : <args><arg>-no-header</arg></args>

result : no header is generated

OTHER TIPS

FYI noFileHeader configuration parameter is supported from 0.9.0. So you can just do

<configuration>
  <noFileHeader>true</noFileHeader>
</configuration>

now.

See controlling the output section in the docs.

@lexicore's answer still works in 0.14.0 version. Simply add <noFileHeader>true</noFileHeader> in the configuration section.

<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<configuration>
    <noFileHeader>true</noFileHeader>
    <schemaLanguage>wsdl</schemaLanguage>
    <generatePackage>[...]</generatePackage>
    <generateDirectory>${project.basedir}/src/main/java</generateDirectory>
    <schemas>
        <schema>
            <url>[...]</url>
        </schema>
    </schemas>
</configuration>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top