Package org.springframework.boot.maven
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
Abstract base class for classes that work with an
Packager
.- Since:
- 2.3.0
- Author:
- Phillip Webb, Scott Frederick
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Archive layout types.Nested classes/interfaces inherited from class org.springframework.boot.maven.AbstractDependencyFilterMojo
AbstractDependencyFilterMojo.ExcludeTestScopeArtifactFilter, AbstractDependencyFilterMojo.RuntimeArtifactFilter
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Include system scoped dependencies.protected org.apache.maven.project.MavenProject
The Maven project.protected org.apache.maven.project.MavenProjectHelper
Maven project helper utils.protected org.apache.maven.execution.MavenSession
The Maven session.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <P extends org.springframework.boot.loader.tools.Packager>
PgetConfiguredPackager
(Supplier<P> supplier) Return aPackager
configured for this MOJO.protected AbstractPackagerMojo.LayoutType
Return the type of archive that should be packaged by this MOJO.protected org.springframework.boot.loader.tools.LayoutFactory
Return the layout factory that will be used to determine theAbstractPackagerMojo.LayoutType
if no explicit layout is set.protected final org.springframework.boot.loader.tools.Libraries
getLibraries
(Collection<org.apache.maven.model.Dependency> unpacks) ReturnLibraries
that the packager can use.protected org.springframework.boot.loader.tools.LoaderImplementation
Return the loader implementation that should be used.protected org.apache.maven.artifact.Artifact
getSourceArtifact
(String classifier) Return the sourceArtifact
to repackage.protected File
getTargetFile
(String finalName, String classifier, File targetDirectory) Methods inherited from class org.springframework.boot.maven.AbstractDependencyFilterMojo
filterDependencies, getDependencyURLs, setExcludeGroupIds, setExcludes, setIncludes, toURL
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
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject projectThe Maven project.- Since:
- 1.0.0
-
session
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession sessionThe Maven session.- Since:
- 2.4.0
-
projectHelper
@Component protected org.apache.maven.project.MavenProjectHelper projectHelperMaven project helper utils.- Since:
- 1.0.0
-
includeSystemScope
@Parameter(defaultValue="false") public boolean includeSystemScopeInclude system scoped dependencies.- Since:
- 1.4.0
-
-
Constructor Details
-
AbstractPackagerMojo
public AbstractPackagerMojo()
-
-
Method Details
-
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
-
getLoaderImplementation
protected org.springframework.boot.loader.tools.LoaderImplementation getLoaderImplementation()Return the loader implementation that should be used.- Returns:
- the loader implementation or
null
- Since:
- 3.2.0
-
getLayoutFactory
protected org.springframework.boot.loader.tools.LayoutFactory getLayoutFactory()Return the layout factory that will be used to determine theAbstractPackagerMojo.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 aPackager
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 ReturnLibraries
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
Return the sourceArtifact
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
-