Package 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BundlePlugin.ClassPathItem
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.archiver.MavenArchiveConfiguration
archive
The archive configuration to use.private org.apache.maven.artifact.resolver.ArtifactCollector
artifactCollector
protected org.apache.maven.artifact.factory.ArtifactFactory
artifactFactory
private org.apache.maven.artifact.metadata.ArtifactMetadataSource
artifactMetadataSource
protected org.apache.maven.artifact.resolver.ArtifactResolver
artifactResolver
Artifact resolver, needed to download source jars for inclusion in classpath.protected org.sonatype.plexus.build.incremental.BuildContext
buildContext
private java.lang.String
buildDirectory
The directory for the generated JAR.private static java.lang.String
BUNDLE_PLUGIN_EXTENSION
private static java.lang.String
BUNDLE_PLUGIN_PREPEND_EXTENSION
protected java.lang.String
classifier
Classifier type of the bundle to be installed.protected boolean
createDependencyReducedPom
If true, remove any inlined or embedded dependencies from the resulting pom.private static java.lang.String[]
DEFAULT_INCLUDES
protected org.apache.maven.shared.dependency.graph.DependencyGraphBuilder
dependencyGraphBuilder
protected java.io.File
dependencyReducedPomLocation
Where to put the dependency reduced pom.protected java.io.File
dumpClasspath
File where the BND class-path will be dumpedprotected java.io.File
dumpInstructions
File where the BND instructions will be dumpedprivate static java.lang.String[]
EMPTY_STRING_ARRAY
protected java.lang.String
excludeDependencies
Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)protected boolean
exportScr
When true, dump the generated SCR filesprivate java.lang.String
finalName
Final name of the bundle (without classifier or extension)private java.util.Map<java.lang.String,java.lang.String>
instructions
The BND instructions for the bundle.private static java.lang.String
LOCAL_PACKAGES
protected org.apache.maven.artifact.repository.ArtifactRepository
localRepository
Local maven repository.private org.codehaus.plexus.archiver.manager.ArchiverManager
m_archiverManager
private org.apache.maven.artifact.handler.manager.ArtifactHandlerManager
m_artifactHandlerManager
private Maven2OsgiConverter
m_maven2OsgiConverter
Use locally patched version for now.private org.apache.maven.execution.MavenSession
m_mavenSession
private org.apache.maven.project.MavenProjectHelper
m_projectHelper
protected java.io.File
manifestLocation
Directory where the manifest will be writtenprivate static java.lang.String
MAVEN_RESOURCES
private static java.lang.String
MAVEN_SOURCES
private static java.lang.String
MAVEN_SYMBOLICNAME
private static java.lang.String
MAVEN_TEST_RESOURCES
private static java.lang.String
MAVEN_TEST_SOURCES
protected org.apache.maven.project.MavenProjectBuilder
mavenProjectBuilder
ProjectBuilder, needed to create projects from the artifacts.protected boolean
niceManifest
Output a nicely formatted manifest that still respects the 72 character line limit.private static java.lang.String
NL
protected java.util.List<java.lang.String>
noWarningProjectTypes
Project types which are not supported, but silently ignored.private java.io.File
outputDirectory
The directory for the generated bundles.private java.lang.String
outputTimestamp
Timestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).protected java.lang.String
packaging
Packaging type of the bundle to be installed.protected org.apache.maven.project.MavenProject
project
The Maven project.protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository>
remoteArtifactRepositories
Remote repositories which will be searched for source attachments.protected java.io.File
scrLocation
Directory where the SCR files will be writtenprotected org.apache.maven.execution.MavenSession
session
private boolean
skip
protected java.util.List<java.lang.String>
supportedProjectTypes
Project types which this plugin supports.protected boolean
unpackBundle
When true, unpack the bundle contents to the outputDirectory
-
Constructor Summary
Constructors Constructor Description BundlePlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
addLocalPackages(java.io.File outputDirectory, aQute.bnd.osgi.Analyzer analyzer)
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, java.util.Map<java.lang.String,java.lang.String> originalInstructions, BundlePlugin.ClassPathItem[] classpath)
protected java.lang.String
convertVersionToOsgi(java.lang.String version)
Convert a Maven version into an OSGi compliant versionprivate java.lang.String
createdBy(java.lang.String description, java.lang.String groupId, java.lang.String artifactId)
private void
createDependencyReducedPom(java.util.Set<java.lang.String> artifactsToRemove)
private void
doMavenMetadata(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Jar jar)
protected static java.lang.StringBuilder
dumpClasspath(java.util.List<aQute.bnd.osgi.Jar> classpath, java.lang.StringBuilder buf)
protected static java.lang.StringBuilder
dumpInstructions(java.util.Properties properties, java.lang.StringBuilder buf)
protected static java.lang.StringBuilder
dumpManifest(java.util.jar.Manifest manifest, java.lang.StringBuilder buf)
void
execute()
protected void
execute(java.util.Map<java.lang.String,java.lang.String> originalInstructions, BundlePlugin.ClassPathItem[] classpath)
private static java.util.jar.Attributes
filterAttributes(aQute.bnd.osgi.Instructions instructions, java.util.jar.Attributes source, java.util.Set<aQute.bnd.osgi.Instruction> nomatch)
protected static java.io.File
getBase(org.apache.maven.project.MavenProject currentProject)
protected java.lang.String
getBuildDirectory()
protected java.lang.String
getBundleName(org.apache.maven.project.MavenProject currentProject)
TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() )protected BundlePlugin.ClassPathItem[]
getClasspath(org.apache.maven.project.MavenProject currentProject)
private static java.lang.String
getCreatedByVersion(java.lang.String groupId, java.lang.String artifactId)
protected java.util.Properties
getDefaultProperties(org.apache.maven.project.MavenProject currentProject)
protected java.util.Collection<org.apache.maven.artifact.Artifact>
getEmbeddableArtifacts(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Analyzer analyzer)
protected java.io.File
getFile(org.apache.maven.artifact.Artifact artifact)
Get the file for an Artifactprivate java.lang.String
getId(java.lang.String groupId, java.lang.String artifactId, java.lang.String type, java.lang.String classifier)
private java.lang.String
getId(org.apache.maven.artifact.Artifact artifact)
private java.lang.String
getId(org.apache.maven.model.Dependency dependency)
protected java.util.Map<java.lang.String,java.lang.String>
getInstructions()
protected Maven2OsgiConverter
getMaven2OsgiConverter()
protected static java.lang.String
getMavenResourcePaths(org.apache.maven.project.MavenProject currentProject, boolean test)
private static java.util.List<org.apache.maven.model.Resource>
getMavenResources(org.apache.maven.project.MavenProject currentProject, boolean test)
protected java.util.Set<java.lang.String>
getOptionalPackages(org.apache.maven.project.MavenProject currentProject)
protected aQute.bnd.osgi.Builder
getOSGiBuilder(org.apache.maven.project.MavenProject currentProject, java.util.Map<java.lang.String,java.lang.String> originalInstructions, BundlePlugin.ClassPathItem[] classpath)
protected java.io.File
getOutputDirectory()
private static java.lang.String
getPackageName(java.lang.String filename)
protected org.apache.maven.project.MavenProject
getProject()
private static java.util.Map<java.lang.String,java.lang.String>
getProperties(org.apache.maven.model.Model projectModel, java.lang.String prefix)
private java.util.Collection<org.apache.maven.artifact.Artifact>
getSelectedDependencies(java.util.Collection<org.apache.maven.artifact.Artifact> artifacts)
private static void
header(java.util.Properties properties, java.lang.String key, java.lang.Object value)
protected static void
includeJava9Fixups(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Analyzer analyzer)
Downgrade the message "Classes found in the wrong directory" to a warning.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(java.util.HashSet<java.lang.String> optionalArtifactIds, org.apache.maven.artifact.Artifact artifact)
Check to see if any dependency along the dependency trail of the artifact is optional.private static void
mergeAttributes(java.util.jar.Attributes... attributesArray)
protected static void
mergeManifest(aQute.bnd.osgi.Instructions instructions, java.util.jar.Manifest... manifests)
protected void
mergeMavenManifest(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Builder builder)
private static java.lang.StringBuffer
printLicenses(java.util.List<org.apache.maven.model.License> licenses)
protected static java.lang.String
removeTagFromInstruction(java.lang.String instruction, java.lang.String tag)
protected boolean
reportErrors(java.lang.String prefix, aQute.bnd.osgi.Analyzer analyzer)
protected static java.lang.String
sanitize(java.lang.Object value)
protected static java.util.Properties
sanitize(java.util.Properties properties)
protected void
setBuildDirectory(java.lang.String _buildirectory)
protected void
setOutputDirectory(java.io.File _outputDirectory)
private byte[]
toFileContentAsBytes(java.util.Properties properties)
protected static java.util.Map<java.lang.String,java.lang.String>
transformDirectives(java.util.Map<java.lang.String,java.lang.String> originalInstructions)
private void
unpackBundle(java.io.File jarFile)
boolean
updateExcludesInDeps(org.apache.maven.project.MavenProject project, java.util.List<org.apache.maven.model.Dependency> dependencies, java.util.List<org.apache.maven.model.Dependency> transitiveDeps)
-
-
-
Field Detail
-
manifestLocation
@Parameter(property="manifestLocation", defaultValue="${project.build.outputDirectory}/META-INF") protected java.io.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 java.io.File dumpInstructions
File where the BND instructions will be dumped
-
dumpClasspath
@Parameter(property="dumpClasspath") protected java.io.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 java.lang.String excludeDependencies
Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
-
finalName
@Parameter(defaultValue="${project.build.finalName}") private java.lang.String finalName
Final name of the bundle (without classifier or extension)
-
classifier
@Parameter protected java.lang.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 java.lang.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.
-
createDependencyReducedPom
@Parameter protected boolean createDependencyReducedPom
If true, remove any inlined or embedded dependencies from the resulting pom.
-
dependencyReducedPomLocation
@Parameter(defaultValue="${basedir}/dependency-reduced-pom.xml") protected java.io.File dependencyReducedPomLocation
Where to put the dependency reduced pom. Note: setting a value for this parameter with a directory other than ${basedir} will change the value of ${basedir} for all executions that come after the shade execution. This is often not what you want. This is considered an open issue with this plugin.
-
scrLocation
@Parameter(defaultValue="${project.build.outputDirectory}") protected java.io.File scrLocation
Directory where the SCR files will be written
-
exportScr
@Parameter protected boolean exportScr
When true, dump the generated SCR files
-
m_projectHelper
@Component private org.apache.maven.project.MavenProjectHelper m_projectHelper
-
m_archiverManager
@Component private org.codehaus.plexus.archiver.manager.ArchiverManager m_archiverManager
-
m_artifactHandlerManager
@Component private org.apache.maven.artifact.handler.manager.ArtifactHandlerManager m_artifactHandlerManager
-
session
@Parameter(defaultValue="${session}", readonly=true) protected org.apache.maven.execution.MavenSession session
-
mavenProjectBuilder
@Component protected org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
ProjectBuilder, needed to create projects from the artifacts.
-
dependencyGraphBuilder
@Component protected org.apache.maven.shared.dependency.graph.DependencyGraphBuilder dependencyGraphBuilder
-
artifactMetadataSource
@Component private org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
-
artifactCollector
@Component private org.apache.maven.artifact.resolver.ArtifactCollector artifactCollector
-
artifactFactory
@Component protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
-
artifactResolver
@Component protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
Artifact resolver, needed to download source jars for inclusion in classpath.
-
localRepository
@Parameter(readonly=true, required=true, defaultValue="${localRepository}") protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
Local maven repository.
-
remoteArtifactRepositories
@Parameter(readonly=true, required=true, defaultValue="${project.remoteArtifactRepositories}") protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories
Remote repositories which will be searched for source attachments.
-
supportedProjectTypes
@Parameter protected java.util.List<java.lang.String> supportedProjectTypes
Project types which this plugin supports.
-
noWarningProjectTypes
@Parameter protected java.util.List<java.lang.String> noWarningProjectTypes
Project types which are not supported, but silently ignored.
-
outputDirectory
@Parameter(defaultValue="${project.build.outputDirectory}") private java.io.File outputDirectory
The directory for the generated bundles.
-
buildDirectory
@Parameter(defaultValue="${project.build.directory}") private java.lang.String buildDirectory
The directory for the generated JAR.
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
The Maven project.
-
instructions
@Parameter private java.util.Map<java.lang.String,java.lang.String> instructions
The BND instructions for the bundle. Maven will expand property macros in these values. If you want to use a BND macro, you must double the dollar sign for the plugin to pass it to BND correctly. For example:
<_consumer-policy>$${range;[===,+)}<code>
</_consumer-policy>
-
m_maven2OsgiConverter
private final Maven2OsgiConverter m_maven2OsgiConverter
Use locally patched version for now.
-
archive
@Parameter private org.apache.maven.archiver.MavenArchiveConfiguration archive
The archive configuration to use.
-
m_mavenSession
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession m_mavenSession
-
outputTimestamp
@Parameter(defaultValue="${project.build.outputTimestamp}") private java.lang.String outputTimestamp
Timestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).- Since:
- 5.1.3
-
buildContext
@Component protected org.sonatype.plexus.build.incremental.BuildContext buildContext
-
skip
@Parameter(defaultValue="false", property="bundle.skip") private boolean skip
-
MAVEN_SYMBOLICNAME
private static final java.lang.String MAVEN_SYMBOLICNAME
- See Also:
- Constant Field Values
-
MAVEN_RESOURCES
private static final java.lang.String MAVEN_RESOURCES
- See Also:
- Constant Field Values
-
MAVEN_TEST_RESOURCES
private static final java.lang.String MAVEN_TEST_RESOURCES
- See Also:
- Constant Field Values
-
LOCAL_PACKAGES
private static final java.lang.String LOCAL_PACKAGES
- See Also:
- Constant Field Values
-
MAVEN_SOURCES
private static final java.lang.String MAVEN_SOURCES
- See Also:
- Constant Field Values
-
MAVEN_TEST_SOURCES
private static final java.lang.String MAVEN_TEST_SOURCES
- See Also:
- Constant Field Values
-
BUNDLE_PLUGIN_EXTENSION
private static final java.lang.String BUNDLE_PLUGIN_EXTENSION
- See Also:
- Constant Field Values
-
BUNDLE_PLUGIN_PREPEND_EXTENSION
private static final java.lang.String BUNDLE_PLUGIN_PREPEND_EXTENSION
- See Also:
- Constant Field Values
-
EMPTY_STRING_ARRAY
private static final java.lang.String[] EMPTY_STRING_ARRAY
-
DEFAULT_INCLUDES
private static final java.lang.String[] DEFAULT_INCLUDES
-
NL
private static final java.lang.String NL
-
-
Method Detail
-
getMaven2OsgiConverter
protected Maven2OsgiConverter getMaven2OsgiConverter()
-
getProject
protected org.apache.maven.project.MavenProject getProject()
-
getInstructions
protected java.util.Map<java.lang.String,java.lang.String> getInstructions()
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
- See Also:
Mojo.execute()
-
transformDirectives
protected static java.util.Map<java.lang.String,java.lang.String> transformDirectives(java.util.Map<java.lang.String,java.lang.String> originalInstructions)
-
reportErrors
protected boolean reportErrors(java.lang.String prefix, aQute.bnd.osgi.Analyzer analyzer)
-
execute
protected void execute(java.util.Map<java.lang.String,java.lang.String> originalInstructions, BundlePlugin.ClassPathItem[] 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, java.util.Map<java.lang.String,java.lang.String> originalInstructions, BundlePlugin.ClassPathItem[] classpath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
sanitize
protected static java.util.Properties sanitize(java.util.Properties properties)
-
sanitize
protected static java.lang.String sanitize(java.lang.Object value)
-
addMavenInstructions
protected void addMavenInstructions(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Builder builder) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createDependencyReducedPom
private void createDependencyReducedPom(java.util.Set<java.lang.String> artifactsToRemove) throws java.io.IOException, org.apache.maven.project.ProjectBuildingException, org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException
- Throws:
java.io.IOException
org.apache.maven.project.ProjectBuildingException
org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException
-
getId
private java.lang.String getId(org.apache.maven.artifact.Artifact artifact)
-
getId
private java.lang.String getId(org.apache.maven.model.Dependency dependency)
-
getId
private java.lang.String getId(java.lang.String groupId, java.lang.String artifactId, java.lang.String type, java.lang.String classifier)
-
updateExcludesInDeps
public boolean updateExcludesInDeps(org.apache.maven.project.MavenProject project, java.util.List<org.apache.maven.model.Dependency> dependencies, java.util.List<org.apache.maven.model.Dependency> transitiveDeps) throws org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException
- Throws:
org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException
-
buildOSGiBundle
protected aQute.bnd.osgi.Builder buildOSGiBundle(org.apache.maven.project.MavenProject currentProject, java.util.Map<java.lang.String,java.lang.String> originalInstructions, BundlePlugin.ClassPathItem[] classpath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
dumpInstructions
protected static java.lang.StringBuilder dumpInstructions(java.util.Properties properties, java.lang.StringBuilder buf)
-
dumpClasspath
protected static java.lang.StringBuilder dumpClasspath(java.util.List<aQute.bnd.osgi.Jar> classpath, java.lang.StringBuilder buf)
-
dumpManifest
protected static java.lang.StringBuilder dumpManifest(java.util.jar.Manifest manifest, java.lang.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 java.lang.Exception
- Throws:
java.lang.Exception
-
getCreatedByVersion
private static java.lang.String getCreatedByVersion(java.lang.String groupId, java.lang.String artifactId)
-
createdBy
private java.lang.String createdBy(java.lang.String description, java.lang.String groupId, java.lang.String artifactId)
-
mergeManifest
protected static void mergeManifest(aQute.bnd.osgi.Instructions instructions, java.util.jar.Manifest... manifests) throws java.io.IOException
- Throws:
java.io.IOException
-
filterAttributes
private static java.util.jar.Attributes filterAttributes(aQute.bnd.osgi.Instructions instructions, java.util.jar.Attributes source, java.util.Set<aQute.bnd.osgi.Instruction> nomatch)
- See Also:
Analyzer.filter(aQute.bnd.osgi.Instructions, aQute.bnd.osgi.Packages, java.util.Set<aQute.bnd.osgi.Instruction>)
-
mergeAttributes
private static void mergeAttributes(java.util.jar.Attributes... attributesArray) throws java.io.IOException
- Throws:
java.io.IOException
-
getOptionalPackages
protected java.util.Set<java.lang.String> getOptionalPackages(org.apache.maven.project.MavenProject currentProject) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
-
isTransitivelyOptional
protected boolean isTransitivelyOptional(java.util.HashSet<java.lang.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
-
-
unpackBundle
private void unpackBundle(java.io.File jarFile)
-
removeTagFromInstruction
protected static java.lang.String removeTagFromInstruction(java.lang.String instruction, java.lang.String tag)
-
getProperties
private static java.util.Map<java.lang.String,java.lang.String> getProperties(org.apache.maven.model.Model projectModel, java.lang.String prefix)
-
printLicenses
private static java.lang.StringBuffer printLicenses(java.util.List<org.apache.maven.model.License> licenses)
-
doMavenMetadata
private void doMavenMetadata(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Jar jar) throws java.io.IOException
- Parameters:
jar
-- Throws:
java.io.IOException
-
toFileContentAsBytes
private byte[] toFileContentAsBytes(java.util.Properties properties)
-
getClasspath
protected BundlePlugin.ClassPathItem[] getClasspath(org.apache.maven.project.MavenProject currentProject) throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
-
getSelectedDependencies
private java.util.Collection<org.apache.maven.artifact.Artifact> getSelectedDependencies(java.util.Collection<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getFile
protected java.io.File getFile(org.apache.maven.artifact.Artifact artifact)
Get the file for an Artifact- Parameters:
artifact
-
-
header
private static void header(java.util.Properties properties, java.lang.String key, java.lang.Object value)
-
convertVersionToOsgi
protected java.lang.String convertVersionToOsgi(java.lang.String version)
Convert a Maven version into an OSGi compliant version- Parameters:
version
- Maven version- Returns:
- the OSGi version
-
getBundleName
protected java.lang.String getBundleName(org.apache.maven.project.MavenProject currentProject)
TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() )
-
getBuildDirectory
protected java.lang.String getBuildDirectory()
-
setBuildDirectory
protected void setBuildDirectory(java.lang.String _buildirectory)
-
getDefaultProperties
protected java.util.Properties getDefaultProperties(org.apache.maven.project.MavenProject currentProject)
-
getBase
protected static java.io.File getBase(org.apache.maven.project.MavenProject currentProject)
-
getOutputDirectory
protected java.io.File getOutputDirectory()
-
setOutputDirectory
protected void setOutputDirectory(java.io.File _outputDirectory)
-
addLocalPackages
private static void addLocalPackages(java.io.File outputDirectory, aQute.bnd.osgi.Analyzer analyzer) throws java.io.IOException
- Throws:
java.io.IOException
-
getPackageName
private static java.lang.String getPackageName(java.lang.String filename)
-
getMavenResources
private static java.util.List<org.apache.maven.model.Resource> getMavenResources(org.apache.maven.project.MavenProject currentProject, boolean test)
-
getMavenResourcePaths
protected static java.lang.String getMavenResourcePaths(org.apache.maven.project.MavenProject currentProject, boolean test)
-
getEmbeddableArtifacts
protected java.util.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)
-
includeJava9Fixups
protected static void includeJava9Fixups(org.apache.maven.project.MavenProject currentProject, aQute.bnd.osgi.Analyzer analyzer)
Downgrade the message "Classes found in the wrong directory" to a warning. This allows the plugin to process a multi-release JAR (see JEP 238, http://openjdk.java.net/jeps/238). Note that the version-specific paths will NOT be visible at runtime nor processed by bnd for imported packages etc. This will not be possible until a runtime solution for multi-release JARs exists in OSGi. This fix only allows these JARs to be processed at all and to be usable on Java 8 (and below), and also on Java 9 where the version-specific customizations are optional.
-
-