Class ManifestPlugin

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="manifest",
          requiresDependencyResolution=TEST,
          threadSafe=true,
          defaultPhase=PROCESS_CLASSES)
    public class ManifestPlugin
    extends org.apache.felix.bundleplugin.BundlePlugin
    Generate an OSGi manifest for this project
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean rebuildBundle
      When true, generate the manifest by rebuilding the full bundle in memory
      • Fields inherited from class org.apache.felix.bundleplugin.BundlePlugin

        artifactFactory, artifactResolver, classifier, createDependencyReducedPom, dependencyReducedPomLocation, dumpClasspath, dumpInstructions, excludeDependencies, exportScr, localRepository, manifestLocation, mavenProjectBuilder, niceManifest, noWarningProjectTypes, packaging, project, remoteArtifactRepositories, scrLocation, session, supportedProjectTypes, unpackBundle
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      ManifestPlugin()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static String calculateExportsFromContents​(aQute.bnd.osgi.Jar bundle)  
      protected void execute​(Map<String,​String> instructions, org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)  
      protected aQute.bnd.osgi.Analyzer getAnalyzer​(org.apache.maven.project.MavenProject project, Map<String,​String> instructions, org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)  
      protected aQute.bnd.osgi.Analyzer getAnalyzer​(org.apache.maven.project.MavenProject project, org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)  
      Manifest getManifest​(org.apache.maven.project.MavenProject project, Map<String,​String> instructions, org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath, org.sonatype.plexus.build.incremental.BuildContext buildContext)  
      Manifest getManifest​(org.apache.maven.project.MavenProject project, org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)  
      static boolean updateFile​(Path path, byte[] newdata)
      Update a file with the given binary content if neeed.
      static void writeManifest​(aQute.bnd.osgi.Analyzer analyzer, File outputFile, boolean niceManifest, boolean exportScr, File scrLocation, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log)  
      static void writeManifest​(Manifest manifest, File outputFile, boolean niceManifest, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log)  
      • Methods inherited from class org.apache.felix.bundleplugin.BundlePlugin

        addMavenInstructions, addMavenSourcePath, buildOSGiBundle, convertVersionToOsgi, dumpClasspath, dumpInstructions, dumpManifest, execute, getBase, getBuildDirectory, getBundleName, getClasspath, getDefaultProperties, getEmbeddableArtifacts, getFile, getInstructions, getMaven2OsgiConverter, getMavenResourcePaths, getOptionalPackages, getOSGiBuilder, getOutputDirectory, getProject, includeJava9Fixups, includeMavenResources, isTransitivelyOptional, mergeManifest, mergeMavenManifest, removeTagFromInstruction, reportErrors, sanitize, sanitize, setBuildDirectory, setOutputDirectory, transformDirectives, updateExcludesInDeps
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
    • Field Detail

      • rebuildBundle

        @Parameter(property="rebuildBundle")
        protected boolean rebuildBundle
        When true, generate the manifest by rebuilding the full bundle in memory
    • Constructor Detail

      • ManifestPlugin

        public ManifestPlugin()
    • Method Detail

      • execute

        protected void execute​(Map<String,​String> instructions,
                               org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)
                        throws org.apache.maven.plugin.MojoExecutionException
        Overrides:
        execute in class org.apache.felix.bundleplugin.BundlePlugin
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getManifest

        public Manifest getManifest​(org.apache.maven.project.MavenProject project,
                                    org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)
                             throws IOException,
                                    org.apache.maven.plugin.MojoFailureException,
                                    org.apache.maven.plugin.MojoExecutionException,
                                    Exception
        Throws:
        IOException
        org.apache.maven.plugin.MojoFailureException
        org.apache.maven.plugin.MojoExecutionException
        Exception
      • getManifest

        public Manifest getManifest​(org.apache.maven.project.MavenProject project,
                                    Map<String,​String> instructions,
                                    org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath,
                                    org.sonatype.plexus.build.incremental.BuildContext buildContext)
                             throws IOException,
                                    org.apache.maven.plugin.MojoFailureException,
                                    org.apache.maven.plugin.MojoExecutionException,
                                    Exception
        Throws:
        IOException
        org.apache.maven.plugin.MojoFailureException
        org.apache.maven.plugin.MojoExecutionException
        Exception
      • getAnalyzer

        protected aQute.bnd.osgi.Analyzer getAnalyzer​(org.apache.maven.project.MavenProject project,
                                                      org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)
                                               throws IOException,
                                                      org.apache.maven.plugin.MojoExecutionException,
                                                      Exception
        Throws:
        IOException
        org.apache.maven.plugin.MojoExecutionException
        Exception
      • getAnalyzer

        protected aQute.bnd.osgi.Analyzer getAnalyzer​(org.apache.maven.project.MavenProject project,
                                                      Map<String,​String> instructions,
                                                      org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem[] classpath)
                                               throws IOException,
                                                      org.apache.maven.plugin.MojoExecutionException,
                                                      Exception
        Throws:
        IOException
        org.apache.maven.plugin.MojoExecutionException
        Exception
      • writeManifest

        public static void writeManifest​(aQute.bnd.osgi.Analyzer analyzer,
                                         File outputFile,
                                         boolean niceManifest,
                                         boolean exportScr,
                                         File scrLocation,
                                         org.sonatype.plexus.build.incremental.BuildContext buildContext,
                                         org.apache.maven.plugin.logging.Log log)
                                  throws Exception
        Throws:
        Exception
      • writeManifest

        public static void writeManifest​(Manifest manifest,
                                         File outputFile,
                                         boolean niceManifest,
                                         org.sonatype.plexus.build.incremental.BuildContext buildContext,
                                         org.apache.maven.plugin.logging.Log log)
                                  throws IOException
        Throws:
        IOException
      • updateFile

        public static boolean updateFile​(Path path,
                                         byte[] newdata)
                                  throws IOException
        Update a file with the given binary content if neeed. The file won't be modified if the content is already the same.
        Parameters:
        path - the path of the file to update
        newdata - the new binary data, null to delete the file
        Returns:
        true if the file was modified, false otherwise
        Throws:
        IOException - if an exception occurs
      • calculateExportsFromContents

        public static String calculateExportsFromContents​(aQute.bnd.osgi.Jar bundle)