Class SplitClasspathMojo

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

@Mojo(name="split-classpath", defaultPhase=PACKAGE, threadSafe=true) public class SplitClasspathMojo extends org.apache.maven.plugin.AbstractMojo
A mojo that splits classpaths into main and app classpaths based on contained file name parts. Handlers spring app package as well as oktoflow classpath jars.
Author:
Holger Eichelberger, SSE
  • Field Details

    • archiveFiles

      @Parameter(property="mdep.archiveFile", defaultValue="", required=true) private List<File> archiveFiles
    • skip

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

      @Parameter(required=false) private List<String> mainPatterns
    • keepClasses

      @Parameter(required=false) private List<String> keepClasses
  • Constructor Details

    • SplitClasspathMojo

      public SplitClasspathMojo()
  • Method Details

    • isMainFile

      private boolean isMainFile(String name, boolean includeSpringLoader)
      Returns whether the given name/line contains on of the main file patterns.
      Parameters:
      name - the name to check
      Returns:
      true for match, 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
    • isCompressed

      private boolean isCompressed(File file)
      Returns whether (parts of) file are compressed/deflated. Keep stored/deflated, in particular for Spring boot app jars, which are either exploded or stored.
      Parameters:
      file - the file to check
      Returns:
      true for compression, false else
    • processFile

      private void processFile(File file) throws org.apache.maven.plugin.MojoExecutionException
      Processes a given file.
      Parameters:
      file - the file to be processed
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if processing fails
    • cleanup

      private void cleanup()
      Cleans up left-over files.
    • processSpringLine

      private String processSpringLine(FileSystem fs, String line) throws IOException
      Processes a spring index line. May move files in the archive.
      Parameters:
      fs - the filesystem to operate on
      line - the line to process
      Returns:
      the potentially modified line
      Throws:
      IOException - if moving files fails
    • postProcessSpringJar

      private void postProcessSpringJar(FileSystem fs) throws IOException
      Post-processes a spring jar, by moving those files that are not mentioned in an index file.
      Parameters:
      fs - the filesystem to operate on
      Throws:
      IOException - if moving files fails
    • moveAll

      public void moveAll(Path sourcePath, Path destPath, boolean keepSourcePath, Predicate<Path> filter) throws IOException
      Moves all files and folders from a source directory to a destination directory.
      Parameters:
      sourcePath - The path to the source directory
      destPath - The path to the destination directory
      keepSourcePath - keep sourcePath itself if true, else remove also sourcePath
      filter - determines the files to move, may be null for all
      Throws:
      IOException - If an I/O error occurs during the move operation