org.apache.felix.bundleplugin

## Class BundlePlugin

- java.lang.Object
- - org.apache.maven.plugin.AbstractMojo
  - - org.apache.felix.bundleplugin.BundlePlugin

- All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
  Direct Known Subclasses:
    AntPlugin, InstructionsPlugin, ManifestPlugin

      @Mojo(name="bundle",
            requiresDependencyResolution=TEST,
            threadSafe=true,
            defaultPhase=PACKAGE)
      public class BundlePlugin
      extends org.apache.maven.plugin.AbstractMojo

  Create an OSGi bundle from Maven project

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `classifier` Classifier type of the bundle to be installed.
    `protected File` | `dumpClasspath` File where the BND class-path will be dumped
    `protected File` | `dumpInstructions` File where the BND instructions will be dumped
    `protected String` | `excludeDependencies` Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
    `protected File` | `manifestLocation` Directory where the manifest will be written
    `protected boolean` | `niceManifest` Output a nicely formatted manifest that still respects the 72 character line limit.
    `protected String` | `packaging` Packaging type of the bundle to be installed.
    `protected List<String>` | `supportedProjectTypes` Project types which this plugin supports.
    `protected boolean` | `unpackBundle` When true, unpack the bundle contents to the outputDirectory

    - ### Fields inherited from interface org.apache.maven.plugin.Mojo

      `ROLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BundlePlugin()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addMavenInstructions(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Builder builder)`
    `protected static void` | `addMavenSourcePath(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Analyzer analyzer, org.apache.maven.plugin.logging.Log log)`
    `protected aQute.bnd.osgi.Builder` | `buildOSGiBundle(org.apache.maven.project.MavenProject currentProject, Map<String,String> originalInstructions, Properties properties, aQute.bnd.osgi.Jar[] classpath)`
    `protected String` | `convertVersionToOsgi(String version)` Convert a Maven version into an OSGi compliant version
    `protected static StringBuilder` | `dumpClasspath(List<aQute.bnd.osgi.Jar> classpath, StringBuilder buf)`
    `protected static StringBuilder` | `dumpInstructions(Properties properties, StringBuilder buf)`
    `protected static StringBuilder` | `dumpManifest(Manifest manifest, StringBuilder buf)`
    `void` | `execute()`
    `protected void` | `execute(org.apache.maven.project.MavenProject currentProject, Map<String,String> originalInstructions, Properties properties)`
    `protected void` | `execute(org.apache.maven.project.MavenProject currentProject, Map<String,String> originalInstructions, Properties properties, aQute.bnd.osgi.Jar[] classpath)`
    `protected static File` | `getBase(org.apache.maven.project.MavenProject currentProject)`
    `protected String` | `getBuildDirectory()`
    `protected String` | `getBundleName(org.apache.maven.project.MavenProject currentProject)` TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() )
    `protected aQute.bnd.osgi.Jar[]` | `getClasspath(org.apache.maven.project.MavenProject currentProject)`
    `protected Properties` | `getDefaultProperties(org.apache.maven.project.MavenProject currentProject)`
    `protected Collection<org.apache.maven.artifact.Artifact>` | `getEmbeddableArtifacts(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Analyzer analyzer)`
    `protected File` | `getFile(org.apache.maven.artifact.Artifact artifact)` Get the file for an Artifact
    `protected Maven2OsgiConverter` | `getMaven2OsgiConverter()`
    `protected static String` | `getMavenResourcePaths(org.apache.maven.project.MavenProject currentProject, boolean test)`
    `protected Set<String>` | `getOptionalPackages(org.apache.maven.project.MavenProject currentProject)`
    `protected aQute.bnd.osgi.Builder` | `getOSGiBuilder(org.apache.maven.project.MavenProject currentProject, Map<String,String> originalInstructions, Properties properties, aQute.bnd.osgi.Jar[] classpath)`
    `protected File` | `getOutputDirectory()`
    `protected org.apache.maven.project.MavenProject` | `getProject()`
    `protected static void` | `includeMavenResources(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Analyzer analyzer, org.apache.maven.plugin.logging.Log log)`
    `protected boolean` | `isTransitivelyOptional(HashSet<String> optionalArtifactIds, org.apache.maven.artifact.Artifact artifact)` Check to see if any dependency along the dependency trail of the artifact is optional.
    `protected void` | `mergeMavenManifest(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Builder builder)`
    `protected static String` | `removeTagFromInstruction(String instruction, String tag)`
    `protected boolean` | `reportErrors(String prefix, aQute.bnd.osgi.Analyzer analyzer)`
    `protected static String` | `sanitize(Object value)`
    `protected static Properties` | `sanitize(Properties properties)`
    `protected void` | `setBuildDirectory(String _buildirectory)`
    `protected void` | `setMaven2OsgiConverter(Maven2OsgiConverter maven2OsgiConverter)`
    `protected void` | `setOutputDirectory(File _outputDirectory)`
    `protected static Map<String,String>` | `transformDirectives(Map<String,String> originalInstructions)`

    - ### 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`

- - ### Field Detail

    - #### manifestLocation

          @Parameter(property="manifestLocation",
                     defaultValue="${project.build.outputDirectory}/META-INF")
          protected File manifestLocation

      Directory where the manifest will be written

    - #### niceManifest

          @Parameter(property="niceManifest",
                     defaultValue="false")
          protected boolean niceManifest

      Output a nicely formatted manifest that still respects the 72 character line limit.

    - #### dumpInstructions

          @Parameter(property="dumpInstructions")
          protected File dumpInstructions

      File where the BND instructions will be dumped

    - #### dumpClasspath

          @Parameter(property="dumpClasspath")
          protected File dumpClasspath

      File where the BND class-path will be dumped

    - #### unpackBundle

          @Parameter(property="unpackBundle")
          protected boolean unpackBundle

      When true, unpack the bundle contents to the outputDirectory

    - #### excludeDependencies

          @Parameter(property="excludeDependencies")
          protected String excludeDependencies

      Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)

    - #### classifier

          @Parameter
          protected String classifier

      Classifier type of the bundle to be installed. For example, "jdk14". Defaults to none which means this is the project's main bundle.

    - #### packaging

          @Parameter
          protected String packaging

      Packaging type of the bundle to be installed. For example, "jar". Defaults to none which means use the same packaging as the project.

    - #### supportedProjectTypes

          @Parameter
          protected List<String> supportedProjectTypes

      Project types which this plugin supports.

  - ### Constructor Detail

    - #### BundlePlugin

          public BundlePlugin()

  - ### Method Detail

    - #### getMaven2OsgiConverter

          protected Maven2OsgiConverter getMaven2OsgiConverter()

    - #### setMaven2OsgiConverter

          protected void setMaven2OsgiConverter(Maven2OsgiConverter maven2OsgiConverter)

    - #### getProject

          protected org.apache.maven.project.MavenProject getProject()

    - #### execute

          public void execute()
                       throws org.apache.maven.plugin.MojoExecutionException

      Throws:
        `org.apache.maven.plugin.MojoExecutionException`
      See Also:
        `Mojo.execute()`

    - #### execute

          protected void execute(org.apache.maven.project.MavenProject currentProject,
                     Map<String,String> originalInstructions,
                     Properties properties)
                          throws org.apache.maven.plugin.MojoExecutionException

      Throws:
        `org.apache.maven.plugin.MojoExecutionException`

    - #### transformDirectives

          protected static Map<String,String> transformDirectives(Map<String,String> originalInstructions)

    - #### reportErrors

          protected boolean reportErrors(String prefix,
                             aQute.bnd.osgi.Analyzer analyzer)

    - #### execute

          protected void execute(org.apache.maven.project.MavenProject currentProject,
                     Map<String,String> originalInstructions,
                     Properties properties,
                     aQute.bnd.osgi.Jar[] classpath)
                          throws org.apache.maven.plugin.MojoExecutionException

      Throws:
        `org.apache.maven.plugin.MojoExecutionException`

    - #### getOSGiBuilder

          protected aQute.bnd.osgi.Builder getOSGiBuilder(org.apache.maven.project.MavenProject currentProject,
                                              Map<String,String> originalInstructions,
                                              Properties properties,
                                              aQute.bnd.osgi.Jar[] classpath)
                                                   throws Exception

      Throws:
        `Exception`

    - #### sanitize

          protected static Properties sanitize(Properties properties)

    - #### sanitize

          protected static String sanitize(Object value)

    - #### addMavenInstructions

          protected void addMavenInstructions(org.apache.maven.project.MavenProject currentProject,
                                  aQute.bnd.osgi.Builder builder)
                                       throws Exception

      Throws:
        `Exception`

    - #### buildOSGiBundle

          protected aQute.bnd.osgi.Builder buildOSGiBundle(org.apache.maven.project.MavenProject currentProject,
                                               Map<String,String> originalInstructions,
                                               Properties properties,
                                               aQute.bnd.osgi.Jar[] classpath)
                                                    throws Exception

      Throws:
        `Exception`

    - #### dumpInstructions

          protected static StringBuilder dumpInstructions(Properties properties,
                                       StringBuilder buf)

    - #### dumpClasspath

          protected static StringBuilder dumpClasspath(List<aQute.bnd.osgi.Jar> classpath,
                                    StringBuilder buf)

    - #### dumpManifest

          protected static StringBuilder dumpManifest(Manifest manifest,
                                   StringBuilder buf)

    - #### includeMavenResources

          protected static void includeMavenResources(org.apache.maven.project.MavenProject currentProject,
                                   aQute.bnd.osgi.Analyzer analyzer,
                                   org.apache.maven.plugin.logging.Log log)

    - #### mergeMavenManifest

          protected void mergeMavenManifest(org.apache.maven.project.MavenProject currentProject,
                                aQute.bnd.osgi.Builder builder)
                                     throws Exception

      Throws:
        `Exception`

    - #### getOptionalPackages

          protected Set<String> getOptionalPackages(org.apache.maven.project.MavenProject currentProject)
                                             throws IOException,
                                                    org.apache.maven.plugin.MojoExecutionException

      Throws:
        `IOException`
        `org.apache.maven.plugin.MojoExecutionException`

    - #### isTransitivelyOptional

          protected boolean isTransitivelyOptional(HashSet<String> optionalArtifactIds,
                                       org.apache.maven.artifact.Artifact artifact)

      Check to see if any dependency along the dependency trail of the artifact is optional.
      Parameters:
        `artifact` -

    - #### removeTagFromInstruction

          protected static String removeTagFromInstruction(String instruction,
                                        String tag)

    - #### getClasspath

          protected aQute.bnd.osgi.Jar[] getClasspath(org.apache.maven.project.MavenProject currentProject)
                                               throws IOException,
                                                      org.apache.maven.plugin.MojoExecutionException

      Throws:
        `IOException`
        `org.apache.maven.plugin.MojoExecutionException`

    - #### getFile

          protected File getFile(org.apache.maven.artifact.Artifact artifact)

      Get the file for an Artifact
      Parameters:
        `artifact` -

    - #### convertVersionToOsgi

          protected String convertVersionToOsgi(String version)

      Convert a Maven version into an OSGi compliant version
      Parameters:
        `version` - Maven version
      Returns:
        the OSGi version

    - #### getBundleName

          protected String getBundleName(org.apache.maven.project.MavenProject currentProject)

      TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() )

    - #### getBuildDirectory

          protected String getBuildDirectory()

    - #### setBuildDirectory

          protected void setBuildDirectory(String _buildirectory)

    - #### getDefaultProperties

          protected Properties getDefaultProperties(org.apache.maven.project.MavenProject currentProject)

    - #### getBase

          protected static File getBase(org.apache.maven.project.MavenProject currentProject)

    - #### getOutputDirectory

          protected File getOutputDirectory()

    - #### setOutputDirectory

          protected void setOutputDirectory(File _outputDirectory)

    - #### getMavenResourcePaths

          protected static String getMavenResourcePaths(org.apache.maven.project.MavenProject currentProject,
                                     boolean test)

    - #### getEmbeddableArtifacts

          protected Collection<org.apache.maven.artifact.Artifact> getEmbeddableArtifacts(org.apache.maven.project.MavenProject currentProject,
                                                                              aQute.bnd.osgi.Analyzer analyzer)
                                                                                   throws org.apache.maven.plugin.MojoExecutionException

      Throws:
        `org.apache.maven.plugin.MojoExecutionException`

    - #### addMavenSourcePath

          protected static void addMavenSourcePath(org.apache.maven.project.MavenProject currentProject,
                                aQute.bnd.osgi.Analyzer analyzer,
                                org.apache.maven.plugin.logging.Log log)

Copyright © 2015. All rights reserved.