2009/2/27 Thierry Templier <[email protected]> > Hello, > > I have a question regarding the use of the maven-bundle-plugin. I try to > develop a bundle with this tool and would like to do the following things. > > 1°) Is it possible to use a particular MANIFEST for my bundle and not to > leave the plugin to generate one for me? >
you can provide a file with manifest entries, just use the <_include>filename</_include> element in your POM (maps to the -include instruction, see http://aqute.biz/Code/Bnd) or you can set your manifest entries directly in the <instructions> section in the POM: <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <configuration> <instructions> <_include>some-manifest-or-property-file.txt</_include> <SomeManifestHeader>some value or other</SomeManifestHeader> <!-- etc --> </instructions> however, the Bnd tool may augment your given manifest with information it finds out about package versions, directives, etc. - but you can turn a lot of this off by using instructions documented at the above Bnd site. For example the <_removeheaders> element will let you remove named entries from the final manifest, allowing you to discard the additional (informational) entries typically added by Bnd: <_removeheaders>Bnd-LastModified,Include-Resource,Private-Package,Tool</_removeheaders> the Bnd tool will also warn you if it thinks your manifest doesn't match the bundle content you could add an extra build step that ensures your exact manifest file is the one in the final bundle, but that would negate a lot of the benefit of the bundleplugin - you might as well jar up your bundle normally with the maven-jar-plugin and then use the Bnd tool in a separate Ant task to verify the bundle is valid. 2°) Is it possible to control the content of this file in order to have > something like that: > > Manifest-Version: 1.0 > > Export-Package: fr.test.spring.osgi.simple.service > > Bundle-Name: Spring OSGi Bundle > > Bundle-SymbolicName: fr.test.spring.osgi.simple yes - you could put these entries in whatever file you include or add them as elements to the <instructions> in your POM. You can also use built-in Maven properties like ${project.name} or custom project properties you set in the POM (or its parents) alternatively you could get Maven to filter this file (like any other resource) and then pull in the filtered version into the bundleplugin instructions > In this case, the problem is that only classes of the specified package are > included in the bundle. Is there a way to specify which packages must be > added in the resulting bundle without specifying additional MANIFEST > headers? > try the 2.0.0 release candidate I mentioned in an earlier post: http://mail-archives.apache.org/mod_mbox/felix-dev/200902.mbox/%[email protected]%3e by default it sets Private-Package to include all your locally compiled classes if you want more control over your bundle content (ie. embedding dependencies or pulling in more resources from non-Maven locations) then you'll have to tell the Bnd tool by adding the relevant headers, as it can't read your mind ;) but you can then use <_removeheaders> to remove them from the final manifest > Thanks for your help! > Thierry > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Cheers, Stuart

