I'm generating java classes from an XSD schema. I'm using JAXB 2.2.7 with maven.
in the pom.xml i've a profile and i use it when the XSD change. The build action rewrite all the java classes from scratch. This is the pom profile:
<profile>
<id>CreateClasses</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${basedir}/src/main/resources/documentazione</schemaDirectory>
<packageName>com.bsssrl.datafatturapa</packageName>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<clearOutputDir>true</clearOutputDir>
<addGeneratedAnnotation>true</addGeneratedAnnotation>
<locale>it</locale>
<properties>
<property>
<name>javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA</name>
<value>http,file</value>
</property>
</properties>
<sources>
<source>${basedir}/src/main/resources/documentazione/fatturapa_v1.2.xsd</source>
</sources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
All the system works well.
Problem: I add some annotations and some methods to the generated classes, for instance some validators and annotations for GUI. If I run the build with the profile CreateClasses because there are some updates on the schema, I loose all the edits.
Question 1 : does exist a way to set a specific Java Class as locked so the system not regenerate this classes?
Question 2 : does exist a way to update a class and not recreate it from blank? Supposing I've 20 properties, now the schema add the 21th one, i don't want to lose my edit to the unchanged properties.