Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add documentation of Embed-* instructions from FELIX-308

...

The default goal bundle will be initialized by setting the <packaging> entry to "bundle".

Embedding dependencies

The Maven Bundle Plugin supports embedding project dependencies into the built bundle using the <Embed-Dependency> instruction listing all dependencies in standard Bundle manifest header syntax:

Code Block
xml
xml

<Embed-Dependency>dependencies</Embed-Dependency>

where:

No Format

dependencies ::= clause ( ',' clause ) *
clause ::= MATCH ( ';' attr '=' MATCH | ';inline=true' )
attr ::= 'groupId' | 'artifactId' | 'version' | 'scope' | 'type' | 'classifier'
MATCH ::= <globbed regular expressions>

some examples:

Code Block
xml
xml

<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>

<Embed-Dependency>junit;scope=test</Embed-Dependency>

<Embed-Dependency>aopalliance;scope=!test;inline=true</Embed-Dependency>

By default matched dependencies are embedded in the bundle under as groupId/artifactId-version.jar. This behaviour can be modified using the following instructions:

  • <Embed-StripGroup>true</Embed-StripGroup> - removes the version from the file (ie. groupId/artifactId.jar)
  • <Embed-StripVersion>true</Embed-StripVersion> - removes the groupId subdirectory (ie. artifactId-version.jar)
  • <Embed-Directory>directory</Embed-Directory> - adds a subdirectory (ie. directory/groupId/artifactId-version.jar)

Normally the plugin only checks direct dependencies, but this can be changed to include the complete set of transitive dependencies with the following option:

Code Block
xml
xml

<Embed-Transitive>true</Embed-Transitive>

If you want a dependency inlined instead of embedded add the inline=true. For example to inline all compile and runtime scoped dependencies use:

Code Block
xml
xml

<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>

Feedback

Subscribe to the Felix users mailing list by sending a message to users-subscribe@felix.apache.org; after subscribing, email questions or feedback to users@felix.apache.org.