Discussion:
Why is cxf-xjc-plugin not regenerating source if xsd changes?
KARR, DAVID
2013-06-24 16:51:40 UTC
Permalink
I've noticed that if I change my XSD and rebuild, using the cxf-xjc-plugin, that the source is not regenerated. If I instead "clean" and rebuild, it regenerates the source. It seems reasonable that it should know to regenerate the source if only the xsd changes. The documentation at <http://cxf.apache.org/cxf-xjc-plugin.html> is somewhat ambiguous. The only reference to regenerating source is in the undocumented "dependencies" element. I tried some guesses on what should be in the "dependencies" element. I got it to not fail the build, but it didn't appear to do anything, either.

The following is my approximate plugin declaration.

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.6.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<extensions>
<extension>JAXBXMLElementWrapperPlugin:JAXBXMLElementWrapperPlugin:1.0.0</extension>
<extension>net.java.dev.jaxb2-commons:jaxb-fluent-api:2.1.8</extension>
</extensions>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/schema/serviceCallResults.xsd</xsd>
<packagename>packagepath.service.domain.serviceCallResults</packagename>
<extension>true</extension>
<extensionArgs>
<extensionArg>-Xxew</extensionArg>
<extensionArg>-summary ${basedir}/target/xew-summary.txt</extensionArg>
<extensionArg>-instantiate lazy</extensionArg>
<extensionArg>-Xfluent-api</extensionArg>
</extensionArgs>
</xsdOption>
...
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
Daniel Kulp
2013-06-24 17:30:53 UTC
Permalink
Can you retry with version 2.6.1? Some code was added in 2.6.1 to support better integration with m2e which allows the change detection to work a little bit better. That said, if the schema includes or imports another schema, it won't detect changes in those schemas and rebuild everything.

Dan
Post by KARR, DAVID
I've noticed that if I change my XSD and rebuild, using the cxf-xjc-plugin, that the source is not regenerated. If I instead "clean" and rebuild, it regenerates the source. It seems reasonable that it should know to regenerate the source if only the xsd changes. The documentation at <http://cxf.apache.org/cxf-xjc-plugin.html> is somewhat ambiguous. The only reference to regenerating source is in the undocumented "dependencies" element. I tried some guesses on what should be in the "dependencies" element. I got it to not fail the build, but it didn't appear to do anything, either.
The following is my approximate plugin declaration.
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.6.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<extensions>
<extension>JAXBXMLElementWrapperPlugin:JAXBXMLElementWrapperPlugin:1.0.0</extension>
<extension>net.java.dev.jaxb2-commons:jaxb-fluent-api:2.1.8</extension>
</extensions>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/schema/serviceCallResults.xsd</xsd>
<packagename>packagepath.service.domain.serviceCallResults</packagename>
<extension>true</extension>
<extensionArgs>
<extensionArg>-Xxew</extensionArg>
<extensionArg>-summary ${basedir}/target/xew-summary.txt</extensionArg>
<extensionArg>-instantiate lazy</extensionArg>
<extensionArg>-Xfluent-api</extensionArg>
</extensionArgs>
</xsdOption>
...
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
--
Daniel Kulp
dkulp-1oDqGaOF3Lkdnm+***@public.gmane.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com
KARR, DAVID
2013-06-24 20:22:05 UTC
Permalink
-----Original Message-----
Sent: Monday, June 24, 2013 10:31 AM
Subject: Re: Why is cxf-xjc-plugin not regenerating source if xsd changes?
Can you retry with version 2.6.1? Some code was added in 2.6.1 to support
better integration with m2e which allows the change detection to work a
little bit better. That said, if the schema includes or imports another
schema, it won't detect changes in those schemas and rebuild everything.
It's possible that helped. After changing the version of cxf-xjc-plugin I'm using, I tried making a trivial change to my schema in Eclipse, and the generated class was changed before I could even run the command-line to compare the mod times. :) It wasn't the same test case as I was hitting earlier, as I couldn't wait for an answer on that, so I did a full clean and rebuild.
Post by KARR, DAVID
I've noticed that if I change my XSD and rebuild, using the cxf-xjc-plugin,
that the source is not regenerated. If I instead "clean" and rebuild, it
regenerates the source. It seems reasonable that it should know to
regenerate the source if only the xsd changes. The documentation at
<http://cxf.apache.org/cxf-xjc-plugin.html> is somewhat ambiguous. The only
reference to regenerating source is in the undocumented "dependencies"
element. I tried some guesses on what should be in the "dependencies"
element. I got it to not fail the build, but it didn't appear to do
anything, either.
Post by KARR, DAVID
The following is my approximate plugin declaration.
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.6.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<extensions>
<extension>JAXBXMLElementWrapperPlugin:JAXBXMLElementWrapperPlugin:1.0.0</ext
ension>
Post by KARR, DAVID
<extension>net.java.dev.jaxb2-commons:jaxb-fluent-
api:2.1.8</extension>
Post by KARR, DAVID
</extensions>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/schema/serviceCallResults.xsd</xsd>
<packagename>packagepath.service.domain.serviceCallResults</packagename>
Post by KARR, DAVID
<extension>true</extension>
<extensionArgs>
<extensionArg>-Xxew</extensionArg>
<extensionArg>-summary ${basedir}/target/xew-
summary.txt</extensionArg>
Post by KARR, DAVID
<extensionArg>-instantiate lazy</extensionArg>
<extensionArg>-Xfluent-api</extensionArg>
</extensionArgs>
</xsdOption>
...
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
--
Daniel Kulp
Talend Community Coder - http://coders.talend.com
Loading...