users@jaxb.java.net

RE: JAXB compilation plugin

From: Jonathan Johnson <jonjohnson_at_mail.com>
Date: Wed, 1 Mar 2006 23:32:14 -0500

> I posted activation.jar and jsr173_1.0_api.jar in the JAXB maven
> repository, too.

Thanks Kohsuke, this works. I also see that you updated the pom for the
plugin. I also cleaned it up. This greatly simplifies my example/testing
pom. Below is an example pom someone could use. Notice the activation.jar
and jsr173_1.0_api.jar are transitive and no longer need to be defined here
since they are in the plugin. Once we post it on the maven repository the
<repository> would not be needed either.

Now we just have to flesh out the <configuration>...</configuration>
section. ;-)


<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.isea</groupId>
    <artifactId>JAXBSample</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>maven-jaxb-plugin example</name>
    <description>Example usage of maven-jaxb-plugin, the xjc compiler.
Invoked in the
        M2 generate phase</description>

    <repositories>
        <repository>
            <id>java.net</id>
            <name>java.net Maven Repository</name>
            <url>https://maven-repository.dev.java.net/nonav/repository</url
>
            <layout>legacy</layout>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>jaxb</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>jaxb</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.sun.tools.xjc.maven2</groupId>
                <artifactId>maven-jaxb-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includeSchemas>
                        <includeSchema>catalog.xsd</includeSchema>
                    </includeSchemas>
                    <generatePackage>com.foo</generatePackage>
                    <generateDir>target/gen/jaxb</generateDir>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>