Package org.apache.felix.bundleplugin
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.felix.bundleplugin.BundlePlugin
BundlePlugin.ClassPathItem
-
-
Field Summary
Fields Modifier and Type Field Description private org.sonatype.plexus.build.incremental.BuildContext
buildContext
protected boolean
rebuildBundle
When true, generate the manifest by rebuilding the full bundle in memoryprivate boolean
supportIncrementalBuild
When true, manifest generation on incremental builds is supported in IDEs like Eclipse.-
Fields inherited from class org.apache.felix.bundleplugin.BundlePlugin
artifactFactory, artifactResolver, classifier, createDependencyReducedPom, dependencyReducedPomLocation, dumpClasspath, dumpInstructions, excludeDependencies, exportScr, localRepository, m_dependencyGraphBuilder, manifestLocation, mavenProjectBuilder, niceManifest, noWarningProjectTypes, packaging, project, remoteArtifactRepositories, scrLocation, session, supportedProjectTypes, unpackBundle
-
-
Constructor Summary
Constructors Constructor Description ManifestPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
anyJavaSourceFileTouchedSinceLastBuild()
Checks if any *.java file was added, updated or removed since last build in any source directory.static java.lang.String
calculateExportsFromContents(aQute.bnd.osgi.Jar bundle)
private boolean
containsJavaFile(org.codehaus.plexus.util.Scanner scanner)
protected void
execute(java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath)
private static void
exportScr(aQute.bnd.osgi.Analyzer analyzer, aQute.bnd.osgi.Jar jar, java.io.File scrLocation, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log)
protected aQute.bnd.osgi.Analyzer
getAnalyzer(org.apache.maven.project.MavenProject project, java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath)
protected aQute.bnd.osgi.Analyzer
getAnalyzer(org.apache.maven.project.MavenProject project, BundlePlugin.ClassPathItem[] classpath)
private java.lang.String
getIncrementalData()
private java.nio.file.Path
getIncrementalDataPath(org.apache.maven.project.MavenProject project)
java.util.jar.Manifest
getManifest(org.apache.maven.project.MavenProject project, java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath, org.sonatype.plexus.build.incremental.BuildContext buildContext)
java.util.jar.Manifest
getManifest(org.apache.maven.project.MavenProject project, BundlePlugin.ClassPathItem[] classpath)
private boolean
isUpToDate(org.apache.maven.project.MavenProject project)
private long
lastmod(java.nio.file.Path p)
private java.util.stream.Stream<java.lang.String>
newer(long lastmod, java.io.File file)
private void
writeIncrementalInfo(org.apache.maven.project.MavenProject project)
static void
writeManifest(aQute.bnd.osgi.Analyzer analyzer, java.io.File outputFile, boolean niceManifest, boolean exportScr, java.io.File scrLocation, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log)
static void
writeManifest(java.util.jar.Manifest manifest, java.io.File outputFile, boolean niceManifest, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log)
private static void
writeSCR(aQute.bnd.osgi.Resource resource, java.io.File destination, 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
-
-
-
-
Field Detail
-
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.
-
buildContext
@Component private org.sonatype.plexus.build.incremental.BuildContext buildContext
-
-
Method Detail
-
execute
protected void execute(java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath) throws org.apache.maven.plugin.MojoExecutionException
- Overrides:
execute
in classBundlePlugin
- 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 java.util.jar.Manifest getManifest(org.apache.maven.project.MavenProject project, BundlePlugin.ClassPathItem[] classpath) throws java.io.IOException, org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException, java.lang.Exception
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
java.lang.Exception
-
getManifest
public java.util.jar.Manifest getManifest(org.apache.maven.project.MavenProject project, java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath, org.sonatype.plexus.build.incremental.BuildContext buildContext) throws java.io.IOException, org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException, java.lang.Exception
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
java.lang.Exception
-
exportScr
private static void exportScr(aQute.bnd.osgi.Analyzer analyzer, aQute.bnd.osgi.Jar jar, java.io.File scrLocation, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeSCR
private static void writeSCR(aQute.bnd.osgi.Resource resource, java.io.File destination, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getAnalyzer
protected aQute.bnd.osgi.Analyzer getAnalyzer(org.apache.maven.project.MavenProject project, BundlePlugin.ClassPathItem[] classpath) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException, java.lang.Exception
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
java.lang.Exception
-
getAnalyzer
protected aQute.bnd.osgi.Analyzer getAnalyzer(org.apache.maven.project.MavenProject project, java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException, java.lang.Exception
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
java.lang.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
-
getIncrementalData
private java.lang.String getIncrementalData()
-
getIncrementalDataPath
private java.nio.file.Path getIncrementalDataPath(org.apache.maven.project.MavenProject project)
-
lastmod
private long lastmod(java.nio.file.Path p)
-
newer
private java.util.stream.Stream<java.lang.String> newer(long lastmod, java.io.File file)
-
writeManifest
public static void writeManifest(aQute.bnd.osgi.Analyzer analyzer, java.io.File outputFile, boolean niceManifest, boolean exportScr, java.io.File scrLocation, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeManifest
public static void writeManifest(java.util.jar.Manifest manifest, java.io.File outputFile, boolean niceManifest, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.plugin.logging.Log log) throws java.io.IOException
- Throws:
java.io.IOException
-
calculateExportsFromContents
public static java.lang.String calculateExportsFromContents(aQute.bnd.osgi.Jar bundle)
-
-