Skip to content

Instantly share code, notes, and snippets.

@lalyos
Created December 13, 2011 14:19
Show Gist options
  • Save lalyos/1472269 to your computer and use it in GitHub Desktop.
Save lalyos/1472269 to your computer and use it in GitHub Desktop.
maven bundle plugin configuration with macros
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<EnvTest><![CDATA[
JAVA_HOME="$<env;JAVA_HOME>"
]]>
</EnvTest>
<myversion>8.8.8</myversion>
<Import-Package><![CDATA[
org.foo.package2;version="$<range;[==,=+);$<myversion>>"
]]>
</Import-Package>
<Message>Yeah Baby</Message>
<ReadFileMacroTest><![CDATA[
textfile=$<cat;delme>
]]>
</ReadFileMacroTest>
<MacroTest><![CDATA[
xmlfiles=$<lsa;target>
]]>
</MacroTest>
<Bundle-Activator>com.epam.osgi2.MyBundleActivator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
@lalyos
Copy link
Author

lalyos commented Dec 13, 2011

maven-bundle-plugin configuration

The documentation of maven-bundle-plugin regarding the BND specific configuration instruction wasn't clear enough.
So i was experimenting and tried to use some bnd macros. To generate the MANIFEST.MF you have to run the following:

mvn bundle:manifest && cat target//classes/META-INF/MANIFEST.MF

The configuration above generates the following MANIFEST.MF:

Manifest-Version: 1.0
...
ReadFileMacroTest: textfile=line 1.
line 2.
line 3.

EnvTest: JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versio
 ns/1.6/Home"
Message: Yeah Baby
MacroTest: xmlfiles=classes,hello-1.0.1.jar,surefire,surefire-reports,
 test-classes
Import-Package: org.foo.package2;version="[8.8,8.9)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment