java.lang.Object
org.apache.maven.plugin.AbstractMojo
de.iip_ecosphere.platform.tools.maven.dependencies.TouchMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="touch", threadSafe=true, defaultPhase=DEPLOY) public class TouchMojo extends org.apache.maven.plugin.AbstractMojo
A simple "touch" command, filling the touch file with service ids from services.properties if respective files change. If onServiceUpdates is disabled, does a default touch, i.e., creating the specified file empty, potentially updating the file creation/modification time.
Author:
Gemini, Holger Eichelberger, SSE
  • Field Details

    • file

      @Parameter(property="touch.file", required=true) private File file
    • onServiceUpdates

      @Parameter(property="touch.onServiceUpdates", required=true, defaultValue="true") private boolean onServiceUpdates
    • deleteBefore

      @Parameter(property="updateArchive.deleteBefore", required=false, defaultValue="false") private boolean deleteBefore
    • skip

      @Parameter(property="updateArchive.skip", required=false, defaultValue="false") private boolean skip
    • passJava

      @Parameter(property="touch.passJava", required=false, defaultValue="false") private boolean passJava
    • javaArtifactsProperty

      @Parameter(required=false, defaultValue="okto.service.artifacts") private String javaArtifactsProperty
    • buildDir

      @Parameter(defaultValue="${project.build.directory}", required=true, readonly=true) private File buildDir
    • basedir

      @Parameter(defaultValue="${project.basedir}", required=true, readonly=true) private File basedir
    • basePath

      private String basePath
    • checkedArtifacts

      private Map<String,Boolean> checkedArtifacts
    • project

      private final org.apache.maven.project.MavenProject project
      POM.
  • Constructor Details

    • TouchMojo

      @Inject protected TouchMojo(org.apache.maven.project.MavenProject project)
      Creates a mojo instance.
      Parameters:
      project - the project instance
  • Method Details

    • 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
    • getChangedFiles

      private Properties getChangedFiles()
      Returns a list of changed service ids (based on file services.properties). May update the corresponding fingerprint files.
      Returns:
      a mapping of service id to status ("j" java, "a" Artifact e.g., for Python), may be empty
    • checkForJavaChanges

      private boolean checkForJavaChanges(Properties hashes)
      Checks for Java changes based on the Java artifacts specified in javaArtifactsProperty.
      Parameters:
      hashes - the file-MD5 hashes
      Returns:
      true if changed, false else
    • findArtifact

      private static File findArtifact(File file)
      Tries to find a file with the given name as specified or in one of the parent folders.
      Parameters:
      file - the file to look for
      Returns:
      file (may not exist) or a file with the same name in a parent folder
    • changed

      private boolean changed(File file, Properties hashes)
      Returns whether file was changed, compared to an eventually existing fingerprint file. May update the corresponding fingerprint file.
      Parameters:
      file - the file
      hashes - the file-MD5 hashes
      Returns:
      true if changed, false else