modello:generate

Full name:

org.codehaus.modello:modello-maven-plugin:2.3.0:generate

Description:

A dynamic way to use generators and Modello plugins.

Example Usage:

  <plugin>
    <groupId>org.codehaus.modello</groupId>
    <artifactId>modello-maven-plugin</artifactId>
    <version>1.3</version>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.modello</groupId>
        <artifactId>modello-plugin-jpa</artifactId>
        <version>1.0.0-SNAPSHOT</version>
      </dependency>
    </dependencies>
    <configuration>
      <version>1.0.0</version>
      <packageWithVersion>false</packageWithVersion>
      <models>
        <model>src/main/mdo/project-model.xml</model>
      </models>
    </configuration>
    <executions>
      <execution>
        <id>java</id>
        <goals>
          <goal>generate</goal>
        </goals>
        <configuration>
          <generatorId>java</generatorId>
        </configuration>
      </execution>
      <execution>
        <id>jpa</id>
        <goals>
          <goal>generate</goal>
        </goals>
        <configuration>
          <generatorId>jpa-mapping</generatorId>
        </configuration>
      </execution>
    </executions>
  </plugin>

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: generate-sources.

Required Parameters

Name Type Since Description
<basedir> String - Base directory of the project, from where the Modello models are loaded.
Default: ${basedir}
<models> String[] - List of relative paths to mdo files containing the models.
<outputDirectory> File - The output directory of the generated Java beans.
Default: ${project.build.directory}/generated-sources/modello
<packageWithVersion> boolean - True if the generated package names should include the version.
Default: false
User Property: packageWithVersion
<version> String - The version of the model we will be working on.
User Property: version

Optional Parameters

Name Type Since Description
<domAsXpp3> boolean 1.6 Generate DOM content as plexus-utils Xpp3Dom objects instead of org.w3c.dom.Element.
Default: true
<encoding> String 1.0-alpha-19 The encoding to use when generating Java source files.
Default: ${project.build.sourceEncoding}
<generatorId> String - No description.
Default: java
User Property: modello.generator.id
<javaSource> String 1.0 The java source level used for generating outputs classes.

Will be discovered from project properties, in order:
  • maven.compiler.release
  • maven.compiler.source
  • maven.compiler.target
If all of above properties was not be set, default value as 8 will be used.
<packagedVersions> List<String> - Additional historical versions to generate, each being packaged with the version regardless of the packageWithVersion setting.

Parameter Details

<basedir>

Base directory of the project, from where the Modello models are loaded.
  • Type: java.lang.String
  • Required: report.plugin.goal.yes
  • Default: ${basedir}

<domAsXpp3>

Generate DOM content as plexus-utils Xpp3Dom objects instead of org.w3c.dom.Element.
  • Type: boolean
  • Since: 1.6
  • Required: report.plugin.goal.no
  • Default: true

<encoding>

The encoding to use when generating Java source files.
  • Type: java.lang.String
  • Since: 1.0-alpha-19
  • Required: report.plugin.goal.no
  • Default: ${project.build.sourceEncoding}

<generatorId>

No description.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: modello.generator.id
  • Default: java

<javaSource>

The java source level used for generating outputs classes.

Will be discovered from project properties, in order:
  • maven.compiler.release
  • maven.compiler.source
  • maven.compiler.target
If all of above properties was not be set, default value as 8 will be used.
  • Type: java.lang.String
  • Since: 1.0
  • Required: report.plugin.goal.no

<models>

List of relative paths to mdo files containing the models.
  • Type: java.lang.String[]
  • Required: report.plugin.goal.yes

<outputDirectory>

The output directory of the generated Java beans.
  • Type: java.io.File
  • Required: report.plugin.goal.yes
  • Default: ${project.build.directory}/generated-sources/modello

<packagedVersions>

Additional historical versions to generate, each being packaged with the version regardless of the packageWithVersion setting.
  • Type: java.util.List<java.lang.String>
  • Required: report.plugin.goal.no

<packageWithVersion>

True if the generated package names should include the version.
  • Type: boolean
  • Required: report.plugin.goal.yes
  • User Property: packageWithVersion
  • Default: false

<version>

The version of the model we will be working on.
  • Type: java.lang.String
  • Required: report.plugin.goal.yes
  • User Property: version