Package aQute.bnd.maven.plugin
Class AbstractBndMavenPlugin
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- aQute.bnd.maven.plugin.AbstractBndMavenPlugin
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
BndMavenPlugin
,BndMavenTestsPlugin
public abstract class AbstractBndMavenPlugin extends org.apache.maven.plugin.AbstractMojo
Abstract base class for all bnd-maven-plugin mojos.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.apache.maven.artifact.handler.manager.ArtifactHandlerManager
artifactHandlerManager
(package private) java.lang.String
bnd
Bnd instructions for this project specified directly in the pom file.(package private) java.lang.String
bndfile
File path to a bnd file containing bnd instructions for this project.(package private) org.sonatype.plexus.build.incremental.BuildContext
buildContext
(package private) java.lang.String
finalName
The name of the created artifact (excluding extension and classifier).(package private) boolean
includeClassesDir
Whether to include the contents of theclassesDir
directory in the generated bundle.(package private) static java.lang.String
LAST_MODIFIED
protected org.slf4j.Logger
logger
(package private) static java.lang.String
MARKED_FILES
(package private) org.apache.maven.plugin.MojoExecution
mojoExecution
(package private) java.lang.String
outputTimestamp
Timestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch.(package private) static java.lang.String
PACKAGING_JAR
(package private) static java.lang.String
PACKAGING_WAR
(package private) java.util.List<java.lang.String>
packagingTypes
The list of maven packaging types for which the plugin will execute.(package private) org.apache.maven.project.MavenProject
project
(package private) org.apache.maven.project.MavenProjectHelper
projectHelper
(package private) java.io.File
propertiesFile
(package private) org.apache.maven.settings.Settings
settings
(package private) boolean
skipIfEmpty
(package private) static java.lang.String
SNAPSHOT
(package private) static java.lang.String
TSTAMP
(package private) java.io.File
webappDirectory
The directory where the webapp is built when packaging iswar
.
-
Constructor Summary
Constructors Constructor Description AbstractBndMavenPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringBuilder
addHeaderAttribute(java.lang.StringBuilder builder, java.lang.String key, java.lang.String value, char separator)
private static java.lang.StringBuilder
addHeaderValue(java.lang.StringBuilder builder, java.lang.String value, char separator)
private void
addMavenMetadataToJar(aQute.bnd.osgi.Jar bndJar)
private void
attachArtifactToProject(aQute.bnd.osgi.Jar bndJar)
private java.lang.String
createArtifactName(org.apache.maven.artifact.Artifact artifact)
void
execute()
private java.io.File
getArtifactFile()
abstract java.io.File
getClassesDir()
java.util.Optional<java.lang.String>
getClassifier()
private java.lang.String
getExtension(java.lang.String type)
abstract java.io.File
getManifestPath()
abstract java.io.File
getOutputDir()
abstract java.util.List<org.apache.maven.model.Resource>
getResources()
abstract java.io.File
getSourceDir()
java.util.Optional<java.lang.String>
getType()
(package private) java.io.File
getWebappDirectory()
protected boolean
isEmpty(java.io.File directory)
abstract boolean
isSkip()
private boolean
outOfDate()
private boolean
outOfDate(java.io.File target)
protected void
processBuilder(aQute.bnd.osgi.Builder builder)
If a mojo needs to tweak the builder for any particular reason, do it here.protected void
processBuildPath(java.util.List<java.lang.Object> buildpath)
If a mojo needs to update the buildpath for any particular reason, do it here.protected void
reportErrorsAndWarnings(aQute.bnd.osgi.Builder builder)
private void
writeContent(aQute.bnd.osgi.Jar jar, java.io.File directory)
private void
writeManifest(aQute.bnd.osgi.Jar jar, java.io.File manifestPath)
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
LAST_MODIFIED
static final java.lang.String LAST_MODIFIED
- See Also:
- Constant Field Values
-
MARKED_FILES
static final java.lang.String MARKED_FILES
- See Also:
- Constant Field Values
-
PACKAGING_JAR
static final java.lang.String PACKAGING_JAR
- See Also:
- Constant Field Values
-
PACKAGING_WAR
static final java.lang.String PACKAGING_WAR
- See Also:
- Constant Field Values
-
TSTAMP
static final java.lang.String TSTAMP
- See Also:
- Constant Field Values
-
SNAPSHOT
static final java.lang.String SNAPSHOT
- See Also:
- Constant Field Values
-
includeClassesDir
@Parameter(defaultValue="true") boolean includeClassesDir
Whether to include the contents of theclassesDir
directory in the generated bundle.
-
webappDirectory
@Parameter(alias="warOutputDir", defaultValue="${project.build.directory}/${project.build.finalName}") java.io.File webappDirectory
The directory where the webapp is built when packaging iswar
.
-
finalName
@Parameter(defaultValue="${project.build.finalName}", readonly=true) java.lang.String finalName
The name of the created artifact (excluding extension and classifier).
-
project
@Parameter(defaultValue="${project}", required=true, readonly=true) org.apache.maven.project.MavenProject project
-
settings
@Parameter(defaultValue="${settings}", readonly=true) org.apache.maven.settings.Settings settings
-
mojoExecution
@Parameter(defaultValue="${mojoExecution}", readonly=true) org.apache.maven.plugin.MojoExecution mojoExecution
-
packagingTypes
@Parameter(property="bnd.packagingTypes", defaultValue="jar,war") java.util.List<java.lang.String> packagingTypes
The list of maven packaging types for which the plugin will execute.
-
skipIfEmpty
@Parameter(property="bnd.skipIfEmpty", defaultValue="false") boolean skipIfEmpty
-
outputTimestamp
@Parameter(defaultValue="${project.build.outputTimestamp}") java.lang.String outputTimestamp
Timestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch.- See Also:
- Configuring for Reproducible Builds
-
bndfile
@Parameter(defaultValue="bnd.bnd") java.lang.String bndfile
File path to a bnd file containing bnd instructions for this project. Defaults tobnd.bnd
. The file path can be an absolute or relative to the project directory.The bnd instructions for this project are merged with the bnd instructions, if any, for the parent project.
-
bnd
@Parameter java.lang.String bnd
Bnd instructions for this project specified directly in the pom file. This is generally be done using a<![CDATA[]]>
section. If the projects has abndfile
, then this configuration element is ignored.The bnd instructions for this project are merged with the bnd instructions, if any, for the parent project.
-
buildContext
@Component org.sonatype.plexus.build.incremental.BuildContext buildContext
-
projectHelper
@Component org.apache.maven.project.MavenProjectHelper projectHelper
-
artifactHandlerManager
@Component org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager
-
propertiesFile
java.io.File propertiesFile
-
-
Method Detail
-
getSourceDir
public abstract java.io.File getSourceDir()
-
getResources
public abstract java.util.List<org.apache.maven.model.Resource> getResources()
-
getClassesDir
public abstract java.io.File getClassesDir()
-
getOutputDir
public abstract java.io.File getOutputDir()
-
getManifestPath
public abstract java.io.File getManifestPath()
-
isSkip
public abstract boolean isSkip()
-
getClassifier
public java.util.Optional<java.lang.String> getClassifier()
-
getType
public java.util.Optional<java.lang.String> getType()
-
getWebappDirectory
java.io.File getWebappDirectory()
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
processBuilder
protected void processBuilder(aQute.bnd.osgi.Builder builder) throws org.apache.maven.plugin.MojoFailureException
If a mojo needs to tweak the builder for any particular reason, do it here.- Parameters:
builder
- the Builder created to analyze the jar contents- Throws:
org.apache.maven.plugin.MojoFailureException
- if an issue is encountered
-
processBuildPath
protected void processBuildPath(java.util.List<java.lang.Object> buildpath)
If a mojo needs to update the buildpath for any particular reason, do it here.- Parameters:
buildpath
- the set of jars and class directories used while analyzing the jar contents
-
addHeaderValue
private static java.lang.StringBuilder addHeaderValue(java.lang.StringBuilder builder, java.lang.String value, char separator)
-
addHeaderAttribute
private static java.lang.StringBuilder addHeaderAttribute(java.lang.StringBuilder builder, java.lang.String key, java.lang.String value, char separator)
-
attachArtifactToProject
private void attachArtifactToProject(aQute.bnd.osgi.Jar bndJar) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addMavenMetadataToJar
private void addMavenMetadataToJar(aQute.bnd.osgi.Jar bndJar) throws java.io.IOException
- Throws:
java.io.IOException
-
getArtifactFile
private java.io.File getArtifactFile()
-
getExtension
private java.lang.String getExtension(java.lang.String type)
-
createArtifactName
private java.lang.String createArtifactName(org.apache.maven.artifact.Artifact artifact)
-
reportErrorsAndWarnings
protected void reportErrorsAndWarnings(aQute.bnd.osgi.Builder builder) throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
isEmpty
protected boolean isEmpty(java.io.File directory)
-
writeContent
private void writeContent(aQute.bnd.osgi.Jar jar, java.io.File directory) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeManifest
private void writeManifest(aQute.bnd.osgi.Jar jar, java.io.File manifestPath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
outOfDate
private boolean outOfDate()
-
outOfDate
private boolean outOfDate(java.io.File target)
-
-