##### General information

- Overview
- News and Status
- Downloads
- Addons
- Changes
- Old Changes
- Wiki
- Issue tracker
- Mailing lists
- Tools
- License
- Team
- Developer Information
- Sponsorship
- Security
- Thanks

##### Documentation

- Tutorial
- OR Mapping Reference
- Code Generation Reference
- Module Documentation
  - Generator
  - Templates
  - Maven Plugin
    - Reference
      - Goal generate
    - Dependencies
    - Project Reports
  - Ant Tasks
  - Runtime

##### Previous releases

- Torque 3.3

## torque:generate

Full name:

org.apache.torque:torque-maven-plugin:4.0:generate

Description:

Executes a unit of generation within the torque generator. $Id: TorqueGeneratorMojo.java 1401885 2012-10-24 21:13:09Z tfischer $

Attributes:

- Requires a Maven project to be executed.

### Required Parameters

Name | Type | Since | Description
--- | --- | --- | ---
defaultOutputDir | `File` | `-` | The default base output directory for the generated files. Whether the configured templates use this directory or not, is up to the templates; check the template documentation.
defaultOutputDirUsage | `String` | `-` | What to do with the generated files in the default output directory. Possible values are: compile: The generated files are treated as compileable sources. In maven-speak, this means the newFileTargetDir will be added as compileSourceRoot of the maven project. test-compile: The generated files are treated as compileable test sources. In maven-speak, this means the newFileTargetDir will be added as testCompileSourceRoot of the maven project. resource: The generated files are treated as resource. This means the newFileTargetDir will be added to the resources of the maven project. test-resource: The generated files are treated as test resource. This means the newFileTargetDir will be added to the test resources of the maven project. none: The generated files are not used in the maven build.
packaging | `String` | `-` | The packaging type of the generation unit, either "directory" , "jar" or "classpath".
projectRootDir | `File` | `-` | The root directory of the project. Has no effect if packaging is "classpath".

### Optional Parameters

Name | Type | Since | Description
--- | --- | --- | ---
addDebuggingInfoToOutput | `boolean` | `-` | Whether to add debug information to the output.
combineFiles | `Boolean` | `-` | Whether all source files should be combined into one source tree. If false, each source file will be read in its own source tree and start a new generation run. If true, a single source tree with the following structure will be built from all source files: <source> <file path="path/to/file1"> <rootOfFile1> ... </rootOfFile1> </file> <file path="path/to/file2"> <rootOfFile2> ... </rootOfFile2> </file> ... </source> If not set, the settings from the templates will be used.
configDir | `File` | `-` | The configuration directory of the generation unit. Has no effect if packaging is "classpath".
configPackage | `String` | `-` | The configuration package of the generation unit. Has only effect if packaging is "classpath".
defaultOutputEncoding | `String` | `-` | The encoding which should be used for the files which do not have an output encoding set in the templates. If not set, the property project.build.sourceEncoding from the maven pom is used. If that is also not set, the generator default is used (which is the platform default encoding).
jarFile | `String` | `-` | The filename of the jar file of the generation unit. Has only effect if packaging is "jar".
loglevel | `String` | `-` | The Loglevel to use in the generation process. Must be one of trace, debug, info, warn or error.
options | `Map` | `-` | Additional options which can be added to the generation process. This overrides both the options set in the templates and the options in optionsFile.
optionsFile | `File` | `-` | Properties file which contains the options which can be added to the generation process. This overrides the options set in the templates, but not the options set by the parameter `options`.
outputDirMap | `Map` | `-` | The target directories for the generated files, keyed by the output directory keys. If output directory keys are used by the output (and if yes, which output directory keys), is up to the templates; check the template documentation. Default is to map the key "modifiable" to ${project.build.directory}/src/main/generated-java
outputDirUsageMap | `Map` | `-` | What to do with the generated files for the output directories defined in outputDirMap. The map uses the same keys as outputDirMap. Possible values are: compile: The generated files are treated as compileable sources. In maven-speak, this means the modifiedFileTargetDir will be added as compileSourceRoot of the maven project. test-compile: The generated files are treated as compileable test sources. In maven-speak, this means the modifiedFileTargetDir will be added as testCompileSourceRoot of the maven project. resource: The generated files are treated as resource. This means the modifiedFileTargetDir will be added to the resources of the maven project. test-resource: The generated files are treated as test resource. This means the modifiedFileTargetDir will be added to the test resources of the maven project. none: The generated files are not used in the maven build. Default is to map the key "modifiable" to compile
overrideConfigDir | `File` | `-` | The config directory of the project overriding the settings. If set, the settings of this directory are used as "child" and the "normal" settings are used as "parent".
overrideConfigPackage | `String` | `-` | The config package of the project overriding the settings. If set, the settings of this directory are used as "child" and the "normal" settings are used as "parent".
sourceDir | `File` | `-` | The directory where the source files reside.
sourceExcludes | `Set` | `-` | Exclude patterns for the source files. If set, the include and exclude patterns from the templates are overridden. If not set, then the include patterns from the templates are used. The patterns are case sensitive, wildcards are * and ?.
sourceIncludes | `Set` | `-` | Include patterns for the source files. If set, the include and exclude patterns from the templates are overridden. If not set, then the include patterns from the templates are used. The patterns are case sensitive, wildcards are * and ?.
workDir | `File` | `-` | The work directory for e.g. merge sources.

### Parameter Details

addDebuggingInfoToOutput:

Whether to add debug information to the output.

- Type: `boolean`
- Required: `No`

combineFiles:

Whether all source files should be combined into one source tree. If false, each source file will be read in its own source tree and start a new generation run. If true, a single source tree with the following structure will be built from all source files: <source> <file path="path/to/file1"> <rootOfFile1> ... </rootOfFile1> </file> <file path="path/to/file2"> <rootOfFile2> ... </rootOfFile2> </file> ... </source> If not set, the settings from the templates will be used.

- Type: `java.lang.Boolean`
- Required: `No`

configDir:

The configuration directory of the generation unit. Has no effect if packaging is "classpath".

- Type: `java.io.File`
- Required: `No`

configPackage:

The configuration package of the generation unit. Has only effect if packaging is "classpath".

- Type: `java.lang.String`
- Required: `No`

defaultOutputDir:

The default base output directory for the generated files. Whether the configured templates use this directory or not, is up to the templates; check the template documentation.

- Type: `java.io.File`
- Required: `Yes`
- Expression: `${project.build.directory}/generated-sources`

defaultOutputDirUsage:

What to do with the generated files in the default output directory. Possible values are:

- compile: The generated files are treated as compileable sources. In maven-speak, this means the newFileTargetDir will be added as compileSourceRoot of the maven project.
- test-compile: The generated files are treated as compileable test sources. In maven-speak, this means the newFileTargetDir will be added as testCompileSourceRoot of the maven project.
- resource: The generated files are treated as resource. This means the newFileTargetDir will be added to the resources of the maven project.
- test-resource: The generated files are treated as test resource. This means the newFileTargetDir will be added to the test resources of the maven project.
- none: The generated files are not used in the maven build.

- Type: `java.lang.String`
- Required: `Yes`
- Expression: `compile`

defaultOutputEncoding:

The encoding which should be used for the files which do not have an output encoding set in the templates. If not set, the property project.build.sourceEncoding from the maven pom is used. If that is also not set, the generator default is used (which is the platform default encoding).

- Type: `java.lang.String`
- Required: `No`

jarFile:

The filename of the jar file of the generation unit. Has only effect if packaging is "jar".

- Type: `java.lang.String`
- Required: `No`

loglevel:

The Loglevel to use in the generation process. Must be one of trace, debug, info, warn or error.

- Type: `java.lang.String`
- Required: `No`

options:

Additional options which can be added to the generation process. This overrides both the options set in the templates and the options in optionsFile.

- Type: `java.util.Map`
- Required: `No`

optionsFile:

Properties file which contains the options which can be added to the generation process. This overrides the options set in the templates, but not the options set by the parameter `options`.

- Type: `java.io.File`
- Required: `No`

outputDirMap:

The target directories for the generated files, keyed by the output directory keys. If output directory keys are used by the output (and if yes, which output directory keys), is up to the templates; check the template documentation. Default is to map the key "modifiable" to ${project.build.directory}/src/main/generated-java

- Type: `java.util.Map`
- Required: `No`

outputDirUsageMap:

What to do with the generated files for the output directories defined in outputDirMap. The map uses the same keys as outputDirMap. Possible values are:

- compile: The generated files are treated as compileable sources. In maven-speak, this means the modifiedFileTargetDir will be added as compileSourceRoot of the maven project.
- test-compile: The generated files are treated as compileable test sources. In maven-speak, this means the modifiedFileTargetDir will be added as testCompileSourceRoot of the maven project.
- resource: The generated files are treated as resource. This means the modifiedFileTargetDir will be added to the resources of the maven project.
- test-resource: The generated files are treated as test resource. This means the modifiedFileTargetDir will be added to the test resources of the maven project.
- none: The generated files are not used in the maven build.
- Default is to map the key "modifiable" to compile

- Type: `java.util.Map`
- Required: `No`

overrideConfigDir:

The config directory of the project overriding the settings. If set, the settings of this directory are used as "child" and the "normal" settings are used as "parent".

- Type: `java.io.File`
- Required: `No`

overrideConfigPackage:

The config package of the project overriding the settings. If set, the settings of this directory are used as "child" and the "normal" settings are used as "parent".

- Type: `java.lang.String`
- Required: `No`

packaging:

The packaging type of the generation unit, either "directory" , "jar" or "classpath".

- Type: `java.lang.String`
- Required: `Yes`
- Expression: `directory`

projectRootDir:

The root directory of the project. Has no effect if packaging is "classpath".

- Type: `java.io.File`
- Required: `Yes`
- Expression: `${basedir}`

sourceDir:

The directory where the source files reside.

- Type: `java.io.File`
- Required: `No`

sourceExcludes:

Exclude patterns for the source files. If set, the include and exclude patterns from the templates are overridden. If not set, then the include patterns from the templates are used. The patterns are case sensitive, wildcards are * and ?.

- Type: `java.util.Set`
- Required: `No`

sourceIncludes:

Include patterns for the source files. If set, the include and exclude patterns from the templates are overridden. If not set, then the include patterns from the templates are used. The patterns are case sensitive, wildcards are * and ?.

- Type: `java.util.Set`
- Required: `No`

workDir:

The work directory for e.g. merge sources.

- Type: `java.io.File`
- Required: `No`
- Expression: `${basedir}/src/main/torque-gen/work`