Package org.apache.sis.internal.maven
Class Assembler
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.sis.internal.maven.Assembler
- All Implemented Interfaces:
FilenameFilter
,org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="dist",
defaultPhase=INSTALL,
requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
public final class Assembler
extends org.apache.maven.plugin.AbstractMojo
implements FilenameFilter
Creates a ZIP file containing the Apache SIS binary distribution.
The created file contains:
- the content of the
application/sis-javafx/src/main/artifact
directory; - the JAR files of all modules and their dependencies, without their native resources;
- the native resources in a separated
lib/
directory.
sis-javafx
module as below:
mvn package org.apache.sis.core:sis-build-helper:dist
Limitation
The current implementation uses some hard-coded paths and filenames. See the Distribution file section in Build from source page for more information.- Since:
- 0.4
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
Base directory of the module to compile.private org.apache.maven.project.MavenProject
Project information (name, version, URL).private String
The root directory (without the "target/binaries
" sub-directory) where JARs are to be copied.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
The filter to use for selecting the files to be included in the ZIP file.private void
appendJAR
(File file, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream bundle, Map<String, byte[]> nativeFiles) Copies a JAR file in the given ZIP file, except the native resources which are stored in the given map.private void
appendRecursively
(File file, String relativeFile, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream out) Adds the given file in the ZIP file.void
execute()
Creates the distribution file.files
(org.apache.maven.project.MavenProject project) Returns all files to include for the given Maven project.private static boolean
Returnstrue
if the given JAR file contains at least one resource in the "native/" directory.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
project
@Parameter(property="project", required=true, readonly=true) private org.apache.maven.project.MavenProject projectProject information (name, version, URL). -
baseDirectory
Base directory of the module to compile. Artifact content is expected in the"src/main/artifact"
subdirectory. -
rootDirectory
The root directory (without the "target/binaries
" sub-directory) where JARs are to be copied. It should be the directory of the rootpom.xml
.
-
-
Constructor Details
-
Assembler
public Assembler()Invoked by reflection for creating the MOJO.
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionCreates the distribution file.- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the plugin execution failed.
-
files
private static Set<File> files(org.apache.maven.project.MavenProject project) throws org.apache.maven.plugin.MojoExecutionException Returns all files to include for the given Maven project.- Throws:
org.apache.maven.plugin.MojoExecutionException
-
appendRecursively
private void appendRecursively(File file, String relativeFile, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream out) throws IOException Adds the given file in the ZIP file. If the given file is a directory, then this method recursively adds all files contained in this directory. This method is invoked for zipping the "application/sis-javafx/src/main/artifact" directory and sub-directories before to zip.- Throws:
IOException
-
accept
The filter to use for selecting the files to be included in the ZIP file.- Specified by:
accept
in interfaceFilenameFilter
- Parameters:
directory
- the directory.filename
- the filename.- Returns:
true
if the given file should be included in the ZIP file.
-
hasNativeResources
Returnstrue
if the given JAR file contains at least one resource in the "native/" directory. Those files will need to be rewritten in order to exclude those resources. -
appendJAR
private void appendJAR(File file, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream bundle, Map<String, byte[]> nativeFiles) throws IOExceptionCopies a JAR file in the given ZIP file, except the native resources which are stored in the given map.- Parameters:
file
- the JAR file to copy.bundle
- destination where to copy the JAR file.nativeFiles
- where to store the native resources.- Throws:
IOException
-