Class JarCollector

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.sis.internal.maven.JarCollector
All Implemented Interfaces:
FileFilter, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="collect-jars", defaultPhase=PACKAGE, requiresDependencyResolution=RUNTIME) public final class JarCollector extends org.apache.maven.plugin.AbstractMojo implements FileFilter
Collects .jar files in a single "target/binaries" directory. Dependencies are collected as well, except if already presents. This mojo uses hard links on platforms that support them. If hard links are not supported, then this mojo will instead creates a "target/binaries/other_dependencies.txt" file listing the dependencies.
Since:
0.3
Version:
1.0
Author:
Martin Desruisseaux (Geomatys)
  • Field Summary

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Invoked by reflection for creating the MOJO.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(File pathname)
    Filters the content of the "target" directory in order to keep only the project build result.
    void
    Copies the *.jar files to the collect directory.

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JarCollector

      public JarCollector()
      Invoked by reflection for creating the MOJO.
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Copies the *.jar files to the collect directory.
      Specified by:
      execute in interface org.apache.maven.plugin.Mojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if the plugin execution failed.
    • accept

      public boolean accept(File pathname)
      Filters the content of the "target" directory in order to keep only the project build result. We scan the directory because the final name may be different than the actual file name, because a classifier may have been added to the name.

      The .jar extension is not quite appropriate for source and Javadoc files; a better extension would be .zip. Unfortunately, the .jar extension for those content is a very common practice, so we have to filter them.

      Specified by:
      accept in interface FileFilter