java - JAXB maven plugin not generating classes -
i trying generate java files xsd, below code doesn't generate. if uncomment outputdirectory, works delete folder first. adding clearoutputdir = false not generating anything.
<build> <plugins> <!-- jaxb xjc plugin invokes xjc compiler compile xml schema java classes.--> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>jaxb2-maven-plugin</artifactid> <executions> <execution> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <!-- package in source files generated. --> <packagename>uk.co.infogen.camel.message</packagename> <!-- schema directory or xsd files. --> <sources> <source>${basedir}/src/main/resources/xsd</source> </sources> <!-- working directory create generated java source files. --> <!--<outputdirectory>${basedir}/src/main/java</outputdirectory> <clearoutputdir>false</clearoutputdir>--> </configuration> </plugin> </plugins> </build> i getting message:
[info] --- jaxb2-maven-plugin:2.2:xjc (default) @ service-business --- [info] ignored given or default xjbsources [/users/aaa/development/workspace/infogen/infogen_example/service-business/src/main/xjb], since not existent file or directory. [info] no changes detected in schema or binding files - skipping jaxb generation.
the first thing should never, ever, generate code inside src/main/java. generated code should not version-controlled , can deleted @ any-time since regenerated anyway.
generated code should located under target, build directory of maven. jaxb2-maven-plugin generate classes default under target/generated-sources/jaxb , there's no reason change that. if you're using eclipse, need add folder buildpath right-clicking , selecting "build path > use source folder".
when running maven, run mvn clean install: clean target folder , regenerate scratch: leads safe , maintainable build. you'll find solve problem: since generated classes deleted before build, correctly re-generated during next build.
of course, if generation process long , don't want each time, can run maven mvn install , configure plugin not remove generated classes setting clearoutputdir false. note that, while build faster, may not detect subsequent errors in xsd if updated.
Comments
Post a Comment