i18n:generate

Full name:

com.github.robtimus:i18n-maven-plugin:3.1:generate

Description:

Generate an I18N class from an I18N resource file.

Attributes:

  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: generate-sources.

Required Parameters

Name Type Since Description
<bundleName> String 1.0 The bundle name to generate an I18N class for. The matching bundle file will be resolved relative to the configured source directory.
User property is: i18n.bundleName.
<outputDirectory> File 1.0 The output directory where the I18N class will be written to, without the package structure. This directory will be added as a project source root if needed.
Default value is: ${project.build.directory}/generated-sources/resource-bundles.
User property is: i18n.outputDirectory.
<sourceDirectory> File 1.0 The source directory where the I18N resource file can be found, without the package structure.
Default value is: ${project.build.resources[0].directory}.
User property is: i18n.sourceDirectory.

Optional Parameters

Name Type Since Description
<className> String 1.0 The fully qualified name of the I18N class to generate. If not specified, the class name will be based on the bundle name.
User property is: i18n.className.
<inputEncoding> String 1.0 The input encoding.
Default value is: ${project.build.sourceEncoding}.
User property is: i18n.inputEncoding.
<licenseCopyrightHolder> String 1.0 The copyright holder to be inserted into the license text.
Default value is: ${user.name}.
User property is: i18n.license.copyrightHolder.
<licenseCopyrightYear> String 1.0 The copyright year to be inserted into the license text. If not configured the current year will be used.
User property is: i18n.license.copyrightYear.
<licenseText> String 1.0 The license text. This can be specified in a few ways:
  • Using one of the pre-defined licenses:
    • Apache-2.0: the Apache License 2.0
    • BSD-2-Clause: the 2-Clause BSD License / FreeBSD License / Simplified BSD License
    • EPL-1.0: the Eclipse Public License 1.0
    • EPL-2.0: the Eclipse Public License 2.0
    • GPL-2.0: the GNU General Public License version 2
    • GPL-3.0: the GNU General Public License version 3
    • LGPL-2.0: the GNU Library General Public License version 2
    • LGPL-2.1: the GNU Lesser General Public License version 2.1
    • MIT: the MIT License
    • MPL-2.0: the Mozilla Public License 2.0
  • As a relative or absolute path to the file containing the license text.
  • As a URL to the file containing the license text.
  • As a literal license text.
Inside the license text three place holders can be used:
  • ${fileName} for the file name.
  • ${copyrightYear} for the copyright year.
  • ${copyrightHolder} for the copyright holder.

User property is: i18n.license.text.
<outputEncoding> String 1.0 The output encoding.
Default value is: ${project.build.sourceEncoding}.
User property is: i18n.outputEncoding.
<publicVisibility> boolean 1.0 If true, generated classes and methods will have public visibility; otherwise they will be package private.
Default value is: true.
User property is: i18n.publicVisibility.
<scope> Scope 1.0 The scope of the project source root, compile or test.
Default value is: compile.
User property is: i18n.scope.
<suppressWarnings> Set<String> 1.0 Warnings that will be suppressed using SuppressWarnings.
User property is: i18n.suppressWarnings.
<useMessageFormat> boolean 1.0 If true, java.text.MessageFormat will be used to format messages; otherwise String#format(java.util.Locale, String, Object...) will be used.
Default value is: false.
User property is: i18n.useMessageFormat.

Parameter Details

<bundleName>

The bundle name to generate an I18N class for. The matching bundle file will be resolved relative to the configured source directory.
  • Type: java.lang.String
  • Since: 1.0
  • Required: Yes
  • User Property: i18n.bundleName

<className>

The fully qualified name of the I18N class to generate. If not specified, the class name will be based on the bundle name.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: i18n.className

<inputEncoding>

The input encoding.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: i18n.inputEncoding
  • Default: ${project.build.sourceEncoding}

<licenseCopyrightHolder>

The copyright holder to be inserted into the license text.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: i18n.license.copyrightHolder
  • Default: ${user.name}

<licenseCopyrightYear>

The copyright year to be inserted into the license text. If not configured the current year will be used.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: i18n.license.copyrightYear

<licenseText>

The license text. This can be specified in a few ways:
  • Using one of the pre-defined licenses:
    • Apache-2.0: the Apache License 2.0
    • BSD-2-Clause: the 2-Clause BSD License / FreeBSD License / Simplified BSD License
    • EPL-1.0: the Eclipse Public License 1.0
    • EPL-2.0: the Eclipse Public License 2.0
    • GPL-2.0: the GNU General Public License version 2
    • GPL-3.0: the GNU General Public License version 3
    • LGPL-2.0: the GNU Library General Public License version 2
    • LGPL-2.1: the GNU Lesser General Public License version 2.1
    • MIT: the MIT License
    • MPL-2.0: the Mozilla Public License 2.0
  • As a relative or absolute path to the file containing the license text.
  • As a URL to the file containing the license text.
  • As a literal license text.
Inside the license text three place holders can be used:
  • ${fileName} for the file name.
  • ${copyrightYear} for the copyright year.
  • ${copyrightHolder} for the copyright holder.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: i18n.license.text

<outputDirectory>

The output directory where the I18N class will be written to, without the package structure. This directory will be added as a project source root if needed.
  • Type: java.io.File
  • Since: 1.0
  • Required: Yes
  • User Property: i18n.outputDirectory
  • Default: ${project.build.directory}/generated-sources/resource-bundles

<outputEncoding>

The output encoding.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: i18n.outputEncoding
  • Default: ${project.build.sourceEncoding}

<publicVisibility>

If true, generated classes and methods will have public visibility; otherwise they will be package private.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: i18n.publicVisibility
  • Default: true

<scope>

The scope of the project source root, compile or test.
  • Type: com.github.robtimus.maven.plugins.i18n.Scope
  • Since: 1.0
  • Required: No
  • User Property: i18n.scope
  • Default: compile

<sourceDirectory>

The source directory where the I18N resource file can be found, without the package structure.
  • Type: java.io.File
  • Since: 1.0
  • Required: Yes
  • User Property: i18n.sourceDirectory
  • Default: ${project.build.resources[0].directory}

<suppressWarnings>

Warnings that will be suppressed using SuppressWarnings.
  • Type: java.util.Set<java.lang.String>
  • Since: 1.0
  • Required: No
  • User Property: i18n.suppressWarnings

<useMessageFormat>

If true, java.text.MessageFormat will be used to format messages; otherwise String#format(java.util.Locale, String, Object...) will be used.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: i18n.useMessageFormat
  • Default: false