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 Details

    • logger

      protected final org.slf4j.Logger logger
    • LAST_MODIFIED

      static final String LAST_MODIFIED
      See Also:
    • MARKED_FILES

      static final String MARKED_FILES
      See Also:
    • PACKAGING_JAR

      static final String PACKAGING_JAR
      See Also:
    • PACKAGING_WAR

      static final String PACKAGING_WAR
      See Also:
    • TSTAMP

      static final String TSTAMP
      See Also:
    • SNAPSHOT

      static final String SNAPSHOT
      See Also:
    • includeClassesDir

      @Parameter(defaultValue="true") boolean includeClassesDir
      Whether to include the contents of the classesDir directory in the generated bundle.
    • webappDirectory

      @Parameter(alias="warOutputDir", defaultValue="${project.build.directory}/${project.build.finalName}") File webappDirectory
      The directory where the webapp is built when packaging is war.
    • finalName

      @Parameter(defaultValue="${project.build.finalName}", readonly=true) 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") List<String> packagingTypes
      The list of maven packaging types for which the plugin will execute.
    • skipIfEmpty

      @Parameter(property="bnd.skipIfEmpty", defaultValue="false") boolean skipIfEmpty
      Skip processing if includeClassesDir is true and the classesDir directory is empty.
    • outputTimestamp

      @Parameter(defaultValue="${project.build.outputTimestamp}") String outputTimestamp
      Timestamp for reproducible output archive entries, either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch.
      See Also:
    • bndfile

      @Parameter(defaultValue="bnd.bnd") String bndfile
      File path to a bnd file containing bnd instructions for this project. Defaults to bnd.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 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 a bndfile, 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

      File propertiesFile
  • Constructor Details

    • AbstractBndMavenPlugin

      public AbstractBndMavenPlugin()
  • Method Details

    • getSourceDir

      public abstract File getSourceDir()
    • getResources

      public abstract List<org.apache.maven.model.Resource> getResources()
    • getClassesDir

      public abstract File getClassesDir()
    • getOutputDir

      public abstract File getOutputDir()
    • getManifestPath

      public abstract File getManifestPath()
    • isSkip

      public abstract boolean isSkip()
    • getClassifier

      public Optional<String> getClassifier()
    • getType

      public Optional<String> getType()
    • getWebappDirectory

      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(List<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 StringBuilder addHeaderValue(StringBuilder builder, String value, char separator)
    • addHeaderAttribute

      private static StringBuilder addHeaderAttribute(StringBuilder builder, String key, String value, char separator)
    • attachArtifactToProject

      private void attachArtifactToProject(aQute.bnd.osgi.Jar bndJar) throws Exception
      Throws:
      Exception
    • addMavenMetadataToJar

      private void addMavenMetadataToJar(aQute.bnd.osgi.Jar bndJar) throws IOException
      Throws:
      IOException
    • getArtifactFile

      private File getArtifactFile()
    • getExtension

      private String getExtension(String type)
    • createArtifactName

      private 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(File directory)
    • writeContent

      private void writeContent(aQute.bnd.osgi.Jar jar, File directory) throws Exception
      Throws:
      Exception
    • writeManifest

      private void writeManifest(aQute.bnd.osgi.Jar jar, File manifestPath) throws Exception
      Throws:
      Exception
    • outOfDate

      private boolean outOfDate()
    • outOfDate

      private boolean outOfDate(File target)