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 BundlePluginGenerate 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.BuildContextbuildContextprotected booleanrebuildBundleWhen true, generate the manifest by rebuilding the full bundle in memoryprivate booleanshowStaleFilesWhen true, show stale files in the log at info level else at debug level.private booleansupportIncrementalBuildWhen 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, dependencyGraphBuilder, dependencyReducedPomLocation, dumpClasspath, dumpInstructions, excludeDependencies, exportScr, localRepository, 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 booleananyJavaSourceFileTouchedSinceLastBuild()Checks if any *.java file was added, updated or removed since last build in any source directory.static java.lang.StringcalculateExportsFromContents(aQute.bnd.osgi.Jar bundle)private booleancontainsJavaFile(org.codehaus.plexus.util.Scanner scanner)protected voidexecute(java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath)private static voidexportScr(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.AnalyzergetAnalyzer(org.apache.maven.project.MavenProject project, java.util.Map<java.lang.String,java.lang.String> instructions, BundlePlugin.ClassPathItem[] classpath)protected aQute.bnd.osgi.AnalyzergetAnalyzer(org.apache.maven.project.MavenProject project, BundlePlugin.ClassPathItem[] classpath)private java.lang.StringgetIncrementalData()private java.nio.file.PathgetIncrementalDataPath(org.apache.maven.project.MavenProject project)java.util.jar.ManifestgetManifest(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.ManifestgetManifest(org.apache.maven.project.MavenProject project, BundlePlugin.ClassPathItem[] classpath)private static org.apache.maven.plugin.MojoExecutionExceptiongetManifestUptodateCheckException(java.io.IOException e)private booleanisMetadataUpToDate(java.io.File outputFile, org.apache.maven.project.MavenProject project)private booleanisUpToDate(org.apache.maven.project.MavenProject project)private longlastmod(java.nio.file.Path p)private static longlastModified(java.nio.file.Path p)private java.util.stream.Stream<java.lang.String>newer(long lastmod, java.io.File file)private voidwriteIncrementalInfo(org.apache.maven.project.MavenProject project)static voidwriteManifest(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 voidwriteManifest(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 voidwriteSCR(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.
-
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
-
-
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:
executein 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.IOExceptionorg.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionExceptionjava.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.IOExceptionorg.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionExceptionjava.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.IOExceptionorg.apache.maven.plugin.MojoExecutionExceptionjava.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.IOExceptionorg.apache.maven.plugin.MojoExecutionExceptionjava.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
-
isMetadataUpToDate
private boolean isMetadataUpToDate(java.io.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(java.io.IOException e)
-
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)
-
lastModified
private static long lastModified(java.nio.file.Path p) throws java.io.IOException- Throws:
java.io.IOException
-
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)
-
-