I was trying to use the jaxb 2.0 maven 2 plugin from 
https://jaxb.dev.java.net/jaxb-maven2-plugin/ with JDK 1.6 but ran into a lot 
of classpath problems when generating the XML bindings. For future reference 
here a plugin setting for use in your m2 project that will use the built in xjc 
in mustang.
   
   <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <mkdir 
dir="${project.build.directory}/generated-sources/xjc"/>
                                <java classname="com.sun.tools.xjc.Driver" 
fork="true">
                                    <arg value="-b"/>
                                    <arg value="${basedir}/src/main/resources"/>
                                    <arg value="-d"/>
                                    <arg 
value="${project.build.directory}/generated-sources/xjc"/>
                                    <arg value="${basedir}/src/main/resources"/>
                                    <classpath>
                                        <pathelement 
location="${java.home}/../lib/tools.jar"/>
                                    </classpath>
                                </java>
                            </tasks>
                            
<sourceRoot>${project.build.directory}/generated-sources/xjc</sourceRoot>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>      
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Reply via email to