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 Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcleanup()Cleans up left-over files.voidexecute()private booleanisCompressed(File file) Returns whether (parts of)fileare compressed/deflated.private booleanisMainFile(String name, boolean includeSpringLoader) Returns whether the given name/line contains on of the main file patterns.voidMoves all files and folders from a source directory to a destination directory.private voidPost-processes a spring jar, by moving those files that are not mentioned in an index file.private voidprocessFile(File file) Processes a given file.private StringprocessSpringLine(FileSystem fs, String line) Processes a spring index line.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
archiveFiles
-
skip
@Parameter(property="mdep.skip", defaultValue="false", required=false) private boolean skip -
mainPatterns
-
keepClasses
-
-
Constructor Details
-
SplitClasspathMojo
public SplitClasspathMojo()
-
-
Method Details
-
isMainFile
Returns whether the given name/line contains on of the main file patterns.- Parameters:
name- the name to check- Returns:
truefor match,falseelse
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
isCompressed
Returns whether (parts of)fileare 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:
truefor compression,falseelse
-
processFile
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
Processes a spring index line. May move files in the archive.- Parameters:
fs- the filesystem to operate online- the line to process- Returns:
- the potentially modified line
- Throws:
IOException- if moving files fails
-
postProcessSpringJar
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 directorydestPath- The path to the destination directorykeepSourcePath- keepsourcePathitself iftrue, else remove alsosourcePathfilter- determines the files to move, may be null for all- Throws:
IOException- If an I/O error occurs during the move operation
-