users@jaxb.java.net

RE: Maven 2 xjc plugin - update notice

From: Jonathan Johnson <jonjohnson_at_mail.com>
Date: Thu, 9 Mar 2006 00:23:23 -0500

Malachi and Kohsuke,

I have updated and tested the Maven 2 xjc plugin. Here are the changes.

- Added directory scanning for **/* include/exclude.
- Binding files are now included/excluded.
- Schema default directory is now "${basedir}/src/main/resources"
- Removed dependency on oro jar.
- Default binding include search is *.xjb"
- Removed old code.

Are there other outstanding issues? If I missed something from your
previous threads it was not intentional. The threads were difficult to sort
out. Please just reiterate any points or ideas that need to be addressed.

The possible settings are

        schemaDirectory
        includeSchemas
        excludeSchemas
        includeBindings
        excludeBindings
        generatePackage
        generateDirectory
        readOnly
        extension
        catalog
        removeOldOutput
        verbose

Below is an example pom.xml that can invoke the plugin.

<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>
    <url>http://maven.apache.org</url>

    <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>*.xsd</includeSchema>
                    </includeSchemas>
                    <excludeSchemas>
                        <excludeSchema>excluded*.xsd</excludeSchema>
                    </excludeSchemas>
                    <generatePackage>com.foo</generatePackage>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>