JAXB XJC Possible to suppress comment creation in generated classes?

前端 未结 8 1216
渐次进展
渐次进展 2021-01-01 09:45

Our project uses XJC to generate Java classes from an XSD. I\'m using JAVA EE 6.

When all the XSDs we have are re-generated, the generated classes include this comm

相关标签:
8条回答
  • 2021-01-01 10:44

    I am using this Maven plugin which replaces the // Generated on: 2011.02.23 at 02:17:06 PM GMT line:

    <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>maven-replacer-plugin</artifactId>
        <version>1.3.8</version>
        <executions>
            <execution> 
                <phase>prepare-package</phase>                          
                <goals>
                    <goal>replace</goal>
                </goals>
            </execution>
        </executions>
        <configuration>                         
            <includes>                              
                <include>src/main/java/jaxb/*.java</include>            
            </includes>
            <token>^// Generated on.*$</token>
            <value>// Generated on: [TEXT REMOVED by maven-replacer-plugin]</value>                         
            <regexFlags>
                <regexFlag>MULTILINE</regexFlag>
            </regexFlags>
        </configuration>
    </plugin>
    
    0 讨论(0)
  • 2021-01-01 10:44

    I know this is 2 years after the fact, but because the classes are generated they aren't necessarily needed in SVN. What needs to be in SVN is the schema or whatever file you use for source to generate the classes. As long as you have the source and the tools to generate the classes, the classes in SVN are redundant and as you saw, problematic in SVN or any SCCS. So put the schema file in SVN and avoid the issue altogether.

    0 讨论(0)
提交回复
热议问题