Using the Plugin

Using the plugin is relatively simple and requires the following steps:

Creating a schema folder

By default, the plugin searches for schema files in src/jaxme. More precisely, it uses the wildcard src/jaxme/*.xsd when looking for schema files. In other words, you put your schema files into src/jaxme, and call them something.xsd. That way, the plugin will automatically detect them.

If you wish to have another location, use the "schema" element for configuring it. See below for an example.

Extending the POM

Your POM needs to declare, that you want to use the plugin. The declaration occurs by adding the following lines:

    <plugins>
      ... Possibly more plugin declarations here
      <plugin>
        <groupId>org.apache.ws.jaxme</groupId>
        <artifactId>maven-jaxme-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>jaxme</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

Note, that the "plugin" section might also contain a "configuration" element, if you need additional configuration. For example, the following might advice the plugin to search for schema files in "src/xsd", rather than "src/jaxme":

        <configuration>
          <schema>src/xsd/*.xsd</schema>
        </configuration>

See the property page for more details on the plugins configuration.

That's it!

Really, you're done. Maven will automatically invoke the plugin for you. The plugin will generate sources, and advice Maven to compile them. Nice, isn't it? :-)