You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Aaron Anderson <ni...@yahoo.com> on 2006/05/22 08:12:47 UTC

[m2] JAXB 2.0 XJC task with mustang - tip

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>

Re: [m2] JAXB 2.0 XJC task with mustang - tip

Posted by Wayne Fay <wa...@gmail.com>.
Thanks Aaron.

I'm not using JDK 1.6 yet, but I like to see excellent examples like
yours below posted to the User list, so people can find useful
examples of things in the User archive.

I'm sure this post will help a good number of people!

Wayne

On 5/22/06, Aaron Anderson <ni...@yahoo.com> wrote:
> 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>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org