properties-constants:generate

Full name:

de.r3s6.maven:properties-constants-maven-plugin:0.5.0:generate

Description:

Goal to create Java constant classes from properties files.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: compile.
  • 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
<basePackage> String - Specifies the Java package of the generated Java classes.

Optional Parameters

Name Type Since Description
<classNameSuffix> String - Suffix to append to generated class names.

Must be a valid java name by itself, SourceVersion.isIdentifier(classNameSuffix)) must return true.


<excludes> String[] - File patterns of files to exclude.
<flattenPackage> boolean - Whether all constants file end up in base package independent of the directory structure.

By default the constants Java classes of properties files located in sub-directories of resourceDir will be put in a matching sub-packages of basePackage.

If flattenPackage is true, all classes will end up in basePackage. Note that this might lead to name collisions.


Default value is: false.
<includes> String[] - File patterns of files to include.
Default value is: *.properties.
<outputDir> File - Output directory for generated java files.
Default value is: ${project.build.directory}/generated-sources/prop-constants.
<resourceDir> File - Directory to search for properties files.
Default value is: src/main/resources.
<skip> boolean - Whether to skip the plugin execution.
User property is: properties-constants.skip.
<sourceEncoding> String - Specifies the character encoding of the generated Java files.
Default value is: ${project.build.sourceEncoding}.
<template> String - Template id or file name.

The plugin provides the templates keys and values.

A file name can be given for a custom Freemarker template. File name lookup is:

  1. classpath
  2. relative to project basedir

Default value is: keys.
<templateOptions> Map<String,String> - Additional options for the selected template.

The template keys supports the following options:

genPropertiesFilenameConstant
generate the constant PROPERTIES_FILE_NAME
propertiesFilenameConstant
changes the name of the properties file name constant
genBundleNameConstant
generate the constant BUNDLE_NAME
bundleNameConstant
changes the name of the bundle name constant

Parameter Details

<basePackage>

Specifies the Java package of the generated Java classes.
  • Type: java.lang.String
  • Required: Yes

<classNameSuffix>

Suffix to append to generated class names.

Must be a valid java name by itself, SourceVersion.isIdentifier(classNameSuffix)) must return true.

  • Type: java.lang.String
  • Required: No

<excludes>

File patterns of files to exclude.
  • Type: java.lang.String[]
  • Required: No

<flattenPackage>

Whether all constants file end up in base package independent of the directory structure.

By default the constants Java classes of properties files located in sub-directories of resourceDir will be put in a matching sub-packages of basePackage.

If flattenPackage is true, all classes will end up in basePackage. Note that this might lead to name collisions.

  • Type: boolean
  • Required: No
  • Default: false

<includes>

File patterns of files to include.
  • Type: java.lang.String[]
  • Required: No
  • Default: *.properties

<outputDir>

Output directory for generated java files.
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/generated-sources/prop-constants

<resourceDir>

Directory to search for properties files.
  • Type: java.io.File
  • Required: No
  • Default: src/main/resources

<skip>

Whether to skip the plugin execution.
  • Type: boolean
  • Required: No
  • User Property: properties-constants.skip

<sourceEncoding>

Specifies the character encoding of the generated Java files.
  • Type: java.lang.String
  • Required: No
  • Default: ${project.build.sourceEncoding}

<template>

Template id or file name.

The plugin provides the templates keys and values.

A file name can be given for a custom Freemarker template. File name lookup is:

  1. classpath
  2. relative to project basedir
  • Type: java.lang.String
  • Required: No
  • Default: keys

<templateOptions>

Additional options for the selected template.

The template keys supports the following options:

genPropertiesFilenameConstant
generate the constant PROPERTIES_FILE_NAME
propertiesFilenameConstant
changes the name of the properties file name constant
genBundleNameConstant
generate the constant BUNDLE_NAME
bundleNameConstant
changes the name of the bundle name constant
  • Type: java.util.Map<java.lang.String, java.lang.String>
  • Required: No