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.AbstractMojoAbstract base class for all bnd-maven-plugin mojos.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.apache.maven.artifact.handler.manager.ArtifactHandlerManagerartifactHandlerManager(package private) java.lang.StringbndBnd instructions for this project specified directly in the pom file.(package private) java.lang.StringbndfileFile path to a bnd file containing bnd instructions for this project.(package private) org.sonatype.plexus.build.incremental.BuildContextbuildContext(package private) java.lang.StringfinalNameThe name of the created artifact (excluding extension and classifier).(package private) booleanincludeClassesDirWhether to include the contents of theclassesDirdirectory in the generated bundle.(package private) static java.lang.StringLAST_MODIFIEDprotected org.slf4j.Loggerlogger(package private) static java.lang.StringMARKED_FILES(package private) org.apache.maven.plugin.MojoExecutionmojoExecution(package private) java.lang.StringoutputTimestampTimestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch.(package private) static java.lang.StringPACKAGING_JAR(package private) static java.lang.StringPACKAGING_WAR(package private) java.util.List<java.lang.String>packagingTypesThe list of maven packaging types for which the plugin will execute.(package private) org.apache.maven.project.MavenProjectproject(package private) org.apache.maven.project.MavenProjectHelperprojectHelper(package private) java.io.FilepropertiesFile(package private) org.apache.maven.settings.Settingssettings(package private) booleanskipIfEmpty(package private) static java.lang.StringSNAPSHOT(package private) static java.lang.StringTSTAMP(package private) java.io.FilewebappDirectoryThe 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.StringBuilderaddHeaderAttribute(java.lang.StringBuilder builder, java.lang.String key, java.lang.String value, char separator)private static java.lang.StringBuilderaddHeaderValue(java.lang.StringBuilder builder, java.lang.String value, char separator)private voidaddMavenMetadataToJar(aQute.bnd.osgi.Jar bndJar)private voidattachArtifactToProject(aQute.bnd.osgi.Jar bndJar)private java.lang.StringcreateArtifactName(org.apache.maven.artifact.Artifact artifact)voidexecute()private java.io.FilegetArtifactFile()abstract java.io.FilegetClassesDir()java.util.Optional<java.lang.String>getClassifier()private java.lang.StringgetExtension(java.lang.String type)abstract java.io.FilegetManifestPath()abstract java.io.FilegetOutputDir()abstract java.util.List<org.apache.maven.model.Resource>getResources()abstract java.io.FilegetSourceDir()java.util.Optional<java.lang.String>getType()(package private) java.io.FilegetWebappDirectory()protected booleanisEmpty(java.io.File directory)abstract booleanisSkip()private booleanoutOfDate()private booleanoutOfDate(java.io.File target)protected voidprocessBuilder(aQute.bnd.osgi.Builder builder)If a mojo needs to tweak the builder for any particular reason, do it here.protected voidprocessBuildPath(java.util.List<java.lang.Object> buildpath)If a mojo needs to update the buildpath for any particular reason, do it here.protected voidreportErrorsAndWarnings(aQute.bnd.osgi.Builder builder)private voidwriteContent(aQute.bnd.osgi.Jar jar, java.io.File directory)private voidwriteManifest(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 theclassesDirdirectory in the generated bundle.
-
webappDirectory
@Parameter(alias="warOutputDir", defaultValue="${project.build.directory}/${project.build.finalName}") java.io.File webappDirectoryThe directory where the webapp is built when packaging iswar.
-
finalName
@Parameter(defaultValue="${project.build.finalName}", readonly=true) java.lang.String finalNameThe 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> packagingTypesThe 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 outputTimestampTimestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor 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.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
processBuilder
protected void processBuilder(aQute.bnd.osgi.Builder builder) throws org.apache.maven.plugin.MojoFailureExceptionIf 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)
-
-