Class ManifestPlugin

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.felix.bundleplugin.BundlePlugin
org.apache.felix.bundleplugin.ManifestPlugin
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
BundleAllPlugin

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

    • rebuildBundle

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

      @Parameter(property="supportIncrementalBuild") private boolean supportIncrementalBuild
      When true, manifest generation on incremental builds is supported in IDEs like Eclipse. Please note that the underlying BND library does not support incremental build, which means always the whole manifest and SCR metadata is generated.
    • showStaleFiles

      @Parameter(property="showStaleFiles") private boolean showStaleFiles
      When true, show stale files in the log at info level else at debug level.
    • buildContext

      @Component private org.sonatype.plexus.build.incremental.BuildContext buildContext
  • Constructor Details

    • ManifestPlugin

      public ManifestPlugin()
  • Method Details

    • execute

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

      private boolean anyJavaSourceFileTouchedSinceLastBuild()
      Checks if any *.java file was added, updated or removed since last build in any source directory.
    • containsJavaFile

      private boolean containsJavaFile(org.codehaus.plexus.util.Scanner scanner)
    • getManifest

      public Manifest getManifest(org.apache.maven.project.MavenProject project, 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, 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
    • exportScr

      private static void exportScr(aQute.bnd.osgi.Analyzer analyzer, aQute.bnd.osgi.Jar jar, File scrLocation, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log) throws Exception
      Throws:
      Exception
    • writeSCR

      private static void writeSCR(aQute.bnd.osgi.Resource resource, File destination, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log) throws Exception
      Throws:
      Exception
    • getAnalyzer

      protected aQute.bnd.osgi.Analyzer getAnalyzer(org.apache.maven.project.MavenProject project, 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, BundlePlugin.ClassPathItem[] classpath) throws IOException, org.apache.maven.plugin.MojoExecutionException, Exception
      Throws:
      IOException
      org.apache.maven.plugin.MojoExecutionException
      Exception
    • writeIncrementalInfo

      private void writeIncrementalInfo(org.apache.maven.project.MavenProject project) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • isUpToDate

      private boolean isUpToDate(org.apache.maven.project.MavenProject project) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • isMetadataUpToDate

      private boolean isMetadataUpToDate(File outputFile, org.apache.maven.project.MavenProject project) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getManifestUptodateCheckException

      private static org.apache.maven.plugin.MojoExecutionException getManifestUptodateCheckException(IOException e)
    • getIncrementalData

      private String getIncrementalData()
    • getIncrementalDataPath

      private Path getIncrementalDataPath(org.apache.maven.project.MavenProject project)
    • lastmod

      private long lastmod(Path p)
    • lastModified

      private static long lastModified(Path p) throws IOException
      Throws:
      IOException
    • newer

      private Stream<String> newer(long lastmod, File file)
    • 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
    • calculateExportsFromContents

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