Apache

Specimen. A proposed redesign of maven.apache.org, not the official Apache Maven site. The official site is maven.apache.org. About this example

Docs Build recipes

Guide to using Modello

Holds for
Not yet checked against Maven 3.9, 3.10 and 4.0
Changed
Source
Edit this page
Wrong?
Report a problem

Modello is a tool for generating resources from a simple model. From a simple model you can generate things like:

  • Java sources
  • XML serialization code for the model
  • XML deserialization code for model
  • Model documentation
  • XSD

A typical modello model looks like the following:

To utilize Modello, you would configure the modello-maven-plugin something like the following where you want to generate the Java sources for the model, the xpp3 serialization code and the xpp3 deserialization code (see modello-plugin-xpp3 for more details):

<project xmlns="http://maven.apache.org/POM/4.0.0">
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.modello</groupId>
        <artifactId>modello-maven-plugin</artifactId>
        <version>1.8.3</version>
        <executions>
          <execution>
            <goals>
              <!-- Generate the xpp3 reader code -->
              <goal>xpp3-reader</goal>
              <!-- Generate the xpp3 writer code -->
              <goal>xpp3-writer</goal>
              <!-- Generate the Java sources for the model itself -->
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <models>
            <model>src/main/mdo/archetype-descriptor.mdo</model>
          </models>
          <version>1.0.0</version>
          <useJava5>true</useJava5>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>