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, Moritz Halbritter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumArchive layout types.Nested classes/interfaces inherited from class AbstractDependencyFilterMojo
AbstractDependencyFilterMojo.ExcludeTestScopeArtifactFilter, AbstractDependencyFilterMojo.RuntimeArtifactFilter -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanInclude optional dependencies.booleanInclude system scoped dependencies.booleanInclude JAR tools.protected org.apache.maven.project.MavenProjectThe Maven project.protected final org.apache.maven.project.MavenProjectHelperMaven project helper utils.protected org.apache.maven.execution.MavenSessionThe Maven session.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPackagerMojo(org.apache.maven.project.MavenProjectHelper projectHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected <P extends org.springframework.boot.loader.tools.Packager>
PgetConfiguredPackager(Supplier<P> supplier) Return aPackagerconfigured for this MOJO.protected @Nullable AbstractPackagerMojo.LayoutTypeReturn the type of archive that should be packaged by this MOJO.protected @Nullable org.springframework.boot.loader.tools.LayoutFactoryReturn the layout factory that will be used to determine theAbstractPackagerMojo.LayoutTypeif no explicit layout is set.protected final org.springframework.boot.loader.tools.LibrariesgetLibraries(@Nullable Collection<org.apache.maven.model.Dependency> unpacks) ReturnLibrariesthat the packager can use.protected org.apache.maven.artifact.ArtifactgetSourceArtifact(@Nullable String classifier) Return the sourceArtifactto repackage.protected FilegetTargetFile(String finalName, @Nullable String classifier, File targetDirectory) Methods inherited from class AbstractDependencyFilterMojo
filterDependencies, getDependencyURLs, setExcludeGroupIds, setExcludes, setIncludes, toURLMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
protected final 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
-
includeOptional
@Parameter(defaultValue="false") public boolean includeOptionalInclude optional dependencies.- Since:
- 3.5.7
-
includeTools
@Parameter(defaultValue="true") public boolean includeToolsInclude JAR tools.- Since:
- 3.3.0
-
-
Constructor Details
-
AbstractPackagerMojo
protected AbstractPackagerMojo(org.apache.maven.project.MavenProjectHelper projectHelper)
-
-
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
-
getLayoutFactory
protected @Nullable org.springframework.boot.loader.tools.LayoutFactory getLayoutFactory()Return the layout factory that will be used to determine theAbstractPackagerMojo.LayoutTypeif 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 aPackagerconfigured 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(@Nullable Collection<org.apache.maven.model.Dependency> unpacks) throws org.apache.maven.plugin.MojoExecutionException ReturnLibrariesthat 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 sourceArtifactto 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
-