## torque:generate

Full name:

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

Description:

Executes a unit of generation within the torque generator. $Id: TorqueGeneratorMojo.java 1873218 2020-01-27 14:36:48Z gk $

Attributes:

- Requires a Maven project to be executed.
- The goal is not marked as thread-safe and thus does not support parallel builds.
- Binds by default to the lifecycle phase: `generate-sources`.

### 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. Default value is: `${project.build.directory}/generated-sources`.
`<packaging>` | `String` | `-` | The packaging type of the generation unit, either "directory" , "jar" or "classpath". Default value is: `directory`.
`<projectRootDir>` | `File` | `-` | The root directory of the project. Has no effect if packaging is "classpath". Default value is: `${basedir}`.

### Optional Parameters

Name | Type | Since | Description
--- | --- | --- | ---
`<addDebuggingInfoToOutput>` | `boolean` | `-` | Whether to add debug information to the output. Default value is: `false`.
`<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".
`<defaultOutputDirUsage>` | `String` | `-` | What to do with the generated files in the default output directory. Possible values are: compile: The default value. 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.
`<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".
`<runOnlyOnSourceChange>` | `boolean` | `-` | True if the generator should only run if one of the source files changes, false if it should always run irrespective of changes in the source files. Default value is: `false`.
`<skip>` | `boolean` | `-` | Specifies whether the execution should be skipped. Default value is: `false`. User property is: `maven.torque.skip`.
`<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. Default value is: `${basedir}/src/main/torque-gen/work`.

### Parameter Details

#### <addDebuggingInfoToOutput>

Whether to add debug information to the output.

- Type: `boolean`
- Required: `No`
- Default: `false`

#### <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`
- Default: `${project.build.directory}/generated-sources`

#### <defaultOutputDirUsage>

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

- compile: The default value. 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: `No`

#### <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`
- Default: `directory`

#### <projectRootDir>

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

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

#### <runOnlyOnSourceChange>

True if the generator should only run if one of the source files changes, false if it should always run irrespective of changes in the source files.

- Type: `boolean`
- Required: `No`
- Default: `false`

#### <skip>

Specifies whether the execution should be skipped.

- Type: `boolean`
- Required: `No`
- User Property: `maven.torque.skip`
- Default: `false`

#### <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`
- Default: `${basedir}/src/main/torque-gen/work`