Package org.basepom.mojo.propertyhelper
Class AbstractPropertyHelperMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.basepom.mojo.propertyhelper.AbstractPropertyHelperMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
,FieldContext
public abstract class AbstractPropertyHelperMojo
extends org.apache.maven.plugin.AbstractMojo
implements FieldContext
-
Field Summary
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
execute()
Returns the base dir for this maven build execution.Returns theInterpolatorFactory
that can interpolate "late resolution" properties.Returns a map with all known macros.org.apache.maven.project.MavenProject
Returns a reference to theMavenProject
.Return the maven project properties.org.apache.maven.settings.Settings
Returns the current mavenSettings
objectReturns a reference to theTransformerRegistry
.void
setActiveGroups
(String... activeGroups) The property groups to activate.void
setDates
(DateDefinition... dateDefinitions) Date property definitions.void
setMacroMap
(Map<String, MacroType> macroMap) void
setMacros
(MacroDefinition... macroDefinitions) Macro definitions.void
setNumbers
(NumberDefinition... numberDefinitions) Number property definitions.void
setOnDuplicateField
(String onDuplicateField) Defines the action to take if a field is defined multiple times (e.g.void
setPropertyGroups
(PropertyGroupDefinition... propertyGroups) Define property groups.void
setStrings
(StringDefinition... stringDefinitions) String property definitions.void
setUuids
(UuidDefinition... uuidDefinitions) Uuid definitions.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
AbstractPropertyHelperMojo
public AbstractPropertyHelperMojo()
-
-
Method Details
-
setOnDuplicateField
@Parameter(defaultValue="fail", alias="onDuplicateProperty") public void setOnDuplicateField(String onDuplicateField) Defines the action to take if a field is defined multiple times (e.g. as a number and a string).
Options areignore
- ignore multiple definitions silently, retain just the first one foundwarn
- like ignore, but also log a warning messagefail
- fail the build with an exception
-
setActiveGroups
The property groups to activate. If none are given, all property groups are activated.<activeGroups> <activeGroup>group1</activeGroup> <activeGroup>group2</activeGroup> ... </activeGroups>
-
setPropertyGroups
Define property groups. A property group contains one or more property definitions. Property groups are active by default unless they are explicitly listed with<activeGroups>...</activeGroups
.<propertyGroups> <propertyGroup> <id>...</id> <activeOnRelease>true|false</activeOnRelease> <activeOnSnapshot>true|false</activeOnSnapshot> <onDuplicateProperty>ignore|warn|fail</onDuplicateProperty> <onMissingField>ignore|warn|fail</onMissingField> <properties> <property> <name>...</name> <value>...</value> <transformers>...</transformers> </property> ... </properties> </propertyGroup> ... </propertyGroups>
-
setNumbers
Number property definitions.<numbers> <number> <id>...</id> <skip>true|false</skip> <export>true|false</export> <fieldNumber>...</fieldNumber> <increment>...</increment> <format>...</format> <regexp>...</regexp> <transformers>...</transformers> <propertyFile>...</propertyFile> <propertyNameInFile>...</propertyNameInFile> <initialValue>...</initialValue> <onMissingFile>ignore|warn|fail|create</onMissingFile> <onMissingFileProperty>ignore|warn|fail|create</onMissingFileProperty> <onMissingProperty>ignore|warn|fail</onMissingProperty> </number> ... </numbers>
-
setStrings
String property definitions.<strings> <string> <id>...</id> <skip>true|false</skip> <export>true|false</export> <values> <value>...</value> ... </values> <blankIsValid>true|false</blankIsValid> <onMissingValue>ignore|warn|fail</onMissingValue <format>...</format> <regexp>...</regexp> <transformers>...</transformers> <propertyFile>...</propertyFile> <propertyNameInFile>...</propertyNameInFile> <initialValue>...</initialValue> <onMissingFile>ignore|warn|fail|create</onMissingFile> <onMissingFileProperty>ignore|warn|fail|create</onMissingFileProperty> <onMissingProperty>ignore|warn|fail</onMissingProperty> </string> ... </strings>
-
setDates
Date property definitions.<dates> <date> <id>...</id> <skip>true|false</skip> <export>true|false</export> <value>...</value> <timezone>...</timezone> <format>...</format> <regexp>...</regexp> <transformers>...</transformers> <propertyFile>...</propertyFile> <propertyNameInFile>...</propertyNameInFile> <initialValue>...</initialValue> <onMissingFile>ignore|warn|fail|create</onMissingFile> <onMissingFileProperty>ignore|warn|fail|create</onMissingFileProperty> <onMissingProperty>ignore|warn|fail</onMissingProperty> </date> ... </dates>
-
setMacros
Macro definitions.<macros> <macro> <id>...</id> <skip>true|false</skip> <export>true|false</export> <macroType>...</macroType> <macroClass>...</macroClass> <properties> <some-name>some-value</some-name> ... </properties> <format>...</format> <regexp>...</regexp> <transformers>...</transformers> <propertyFile>...</propertyFile> <propertyNameInFile>...</propertyNameInFile> <initialValue>...</initialValue> <onMissingFile>ignore|warn|fail|create</onMissingFile> <onMissingFileProperty>ignore|warn|fail|create</onMissingFileProperty> <onMissingProperty>ignore|warn|fail</onMissingProperty> </macro> ... </macros>
-
setUuids
Uuid definitions.<uuids> <uuid> <id>...</id> <skip>true|false</skip> <export>true|false</export> <value>...</value> <format>...</format> <regexp>...</regexp> <transformers>...</transformers> <propertyFile>...</propertyFile> <propertyNameInFile>...</propertyNameInFile> <initialValue>...</initialValue> <onMissingFile>ignore|warn|fail|create</onMissingFile> <onMissingFileProperty>ignore|warn|fail|create</onMissingFileProperty> <onMissingProperty>ignore|warn|fail</onMissingProperty> </uuid> ... </uuids>
-
setMacroMap
-
execute
- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getProject
Description copied from interface:FieldContext
Returns a reference to theMavenProject
.- Specified by:
getProject
in interfaceFieldContext
- Returns:
- A
MavenProject
object
-
getBasedir
Description copied from interface:FieldContext
Returns the base dir for this maven build execution.- Specified by:
getBasedir
in interfaceFieldContext
- Returns:
- A
File
object.
-
getSettings
Description copied from interface:FieldContext
Returns the current mavenSettings
object- Specified by:
getSettings
in interfaceFieldContext
- Returns:
- A
Settings
object
-
getMacros
Description copied from interface:FieldContext
Returns a map with all known macros. Key value is the macro hint as given by the plexus component annotation.- Specified by:
getMacros
in interfaceFieldContext
- Returns:
- A map with all known macros.
-
getProjectProperties
Description copied from interface:FieldContext
Return the maven project properties.- Specified by:
getProjectProperties
in interfaceFieldContext
- Returns:
- A properties object for the project properties.
-
getInterpolatorFactory
Description copied from interface:FieldContext
Returns theInterpolatorFactory
that can interpolate "late resolution" properties.- Specified by:
getInterpolatorFactory
in interfaceFieldContext
- Returns:
- An
InterpolatorFactory
reference.
-
getTransformerRegistry
Description copied from interface:FieldContext
Returns a reference to theTransformerRegistry
.- Specified by:
getTransformerRegistry
in interfaceFieldContext
- Returns:
- A
TransformerRegistry
object.
-
createGroups
-