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
Direct Known Subclasses:
GetMojo, IncMojo

public abstract class AbstractPropertyHelperMojo extends org.apache.maven.plugin.AbstractMojo implements FieldContext
  • Constructor Details

  • 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 are
      • ignore - ignore multiple definitions silently, retain just the first one found
      • warn - like ignore, but also log a warning message
      • fail - fail the build with an exception
    • setActiveGroups

      @Parameter public void setActiveGroups(String... activeGroups)
      The property groups to activate. If none are given, all property groups are activated.
      
       <activeGroups>
           <activeGroup>group1</activeGroup>
           <activeGroup>group2</activeGroup>
           ...
       </activeGroups>
       
    • setPropertyGroups

      @Parameter public void setPropertyGroups(PropertyGroupDefinition... propertyGroups)
      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

      @Parameter public void setNumbers(NumberDefinition... numberDefinitions)
      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

      @Parameter public void setStrings(StringDefinition... stringDefinitions)
      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

      @Parameter public void setDates(DateDefinition... dateDefinitions)
      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

      @Parameter public void setMacros(MacroDefinition... macroDefinitions)
      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

      @Parameter public void setUuids(UuidDefinition... uuidDefinitions)
      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

      @Inject public void setMacroMap(Map<String,MacroType> macroMap)
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Specified by:
      execute in interface org.apache.maven.plugin.Mojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getProject

      public org.apache.maven.project.MavenProject getProject()
      Description copied from interface: FieldContext
      Returns a reference to the MavenProject.
      Specified by:
      getProject in interface FieldContext
      Returns:
      A MavenProject object
    • getBasedir

      public File getBasedir()
      Description copied from interface: FieldContext
      Returns the base dir for this maven build execution.
      Specified by:
      getBasedir in interface FieldContext
      Returns:
      A File object.
    • getSettings

      public org.apache.maven.settings.Settings getSettings()
      Description copied from interface: FieldContext
      Returns the current maven Settings object
      Specified by:
      getSettings in interface FieldContext
      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 interface FieldContext
      Returns:
      A map with all known macros.
    • getProjectProperties

      Description copied from interface: FieldContext
      Return the maven project properties.
      Specified by:
      getProjectProperties in interface FieldContext
      Returns:
      A properties object for the project properties.
    • getInterpolatorFactory

      Description copied from interface: FieldContext
      Returns the InterpolatorFactory that can interpolate "late resolution" properties.
      Specified by:
      getInterpolatorFactory in interface FieldContext
      Returns:
      An InterpolatorFactory reference.
    • getTransformerRegistry

      Description copied from interface: FieldContext
      Returns a reference to the TransformerRegistry.
      Specified by:
      getTransformerRegistry in interface FieldContext
      Returns:
      A TransformerRegistry object.
    • createGroups

      public void createGroups()