Class AbstractPackagerMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.springframework.boot.maven.AbstractDependencyFilterMojo
org.springframework.boot.maven.AbstractPackagerMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
BuildImageMojo, RepackageMojo

public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
Abstract base class for classes that work with an Packager.
Since:
2.3.0
Author:
Phillip Webb, Scott Frederick
  • Field Details

    • project

      @Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
      The Maven project.
      Since:
      1.0.0
    • session

      @Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session
      The Maven session.
      Since:
      2.4.0
    • projectHelper

      @Component protected org.apache.maven.project.MavenProjectHelper projectHelper
      Maven project helper utils.
      Since:
      1.0.0
    • includeSystemScope

      @Parameter(defaultValue="false") public boolean includeSystemScope
      Include system scoped dependencies.
      Since:
      1.4.0
  • Constructor Details

    • AbstractPackagerMojo

      public AbstractPackagerMojo()
  • Method Details

    • getLayout

      protected AbstractPackagerMojo.LayoutType getLayout()
      Return the type of archive that should be packaged by this MOJO.
      Returns:
      null, indicating a layout type will be chosen based on the original archive type
    • getLayoutFactory

      protected org.springframework.boot.loader.tools.LayoutFactory getLayoutFactory()
      Return the layout factory that will be used to determine the AbstractPackagerMojo.LayoutType if no explicit layout is set.
      Returns:
      null, indicating a default layout factory will be chosen
    • getConfiguredPackager

      protected <P extends org.springframework.boot.loader.tools.Packager> P getConfiguredPackager(Supplier<P> supplier)
      Return a Packager configured for this MOJO.
      Type Parameters:
      P - the packager type
      Parameters:
      supplier - a packager supplier
      Returns:
      a configured packager
    • getLibraries

      protected final org.springframework.boot.loader.tools.Libraries getLibraries(Collection<org.apache.maven.model.Dependency> unpacks) throws org.apache.maven.plugin.MojoExecutionException
      Return Libraries that the packager can use.
      Parameters:
      unpacks - any libraries that require unpack
      Returns:
      the libraries to use
      Throws:
      org.apache.maven.plugin.MojoExecutionException - on execution error
    • getSourceArtifact

      protected org.apache.maven.artifact.Artifact getSourceArtifact(String classifier)
      Return the source Artifact to repackage. If a classifier is specified and an artifact with that classifier exists, it is used. Otherwise, the main artifact is used.
      Parameters:
      classifier - the artifact classifier
      Returns:
      the source artifact to repackage
    • getTargetFile

      protected File getTargetFile(String finalName, String classifier, File targetDirectory)