Class TextFileMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
de.iip_ecosphere.platform.configuration.maven.TextFileMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="textFile", defaultPhase=COMPILE) public class TextFileMojo extends org.apache.maven.plugin.AbstractMojo
Allows simple line-based modifications to a text file.
Author:
Holger Eichelberger, SSE
  • Field Details

    • skip

      @Parameter(property="configuration.textFile.skip", required=false, defaultValue="false") private boolean skip
    • file

      @Parameter(property="configuration.textFile.file", required=true) private File file
    • prepends

      @Parameter(property="configuration.textFile.prepends", required=false) private List<String> prepends
    • appends

      @Parameter(property="configuration.textFile.appends", required=false) private List<String> appends
    • deletions

      @Parameter(property="configuration.textFile.deletions", required=false) private Set<String> deletions
    • disabled

      @Parameter(property="configuration.textFile.disabled", required=false) private Set<String> disabled
    • replacements

      @Parameter private List<TextFileMojo.ReplacementSpec> replacements
  • Constructor Details

    • TextFileMojo

      public TextFileMojo()
  • Method Details

    • isDisabled

      private boolean isDisabled(TextFileMojo.ReplacementSpec spec)
      Checks whether the given spec is disabled.
      Parameters:
      spec - the replacement specification
      Returns:
      true for disabled, false else
    • applyReplacements

      private String applyReplacements(String line)
      Applies the specified replacements to line.
      Parameters:
      line - the line to apply the replacements to
      Returns:
      the line with applied replacements
    • isNonEmpty

      private static boolean isNonEmpty(Collection<?> coll)
      Returns whether a collection is not null and not empty.
      Parameters:
      coll - the collection to test
      Returns:
      true for not empty, false else
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException