2009/3/10 viewer <[email protected]>
>
> Hello!
> I am using maven bundle plugin and I have some questions and issues.
> 1. I have set the packaging to bundle, but when I run mvn command i get the
> following error:
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Cannot find lifecycle mapping for packaging: 'bundle'.
> Component descriptor cannot be found in the component repository:
> org.apache.maven.lifecycle.mapping.LifecycleMappingbundle.
> [INFO]
> ------------------------------------------------------------------------
>
have you added the bundleplugin to the <build> part of your pom.xml like so:
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.0.0</version>
* <extensions>true</extensions>
* </plugin>
<!-- ...other plugins... -->
</plugins>
</build>
make especially sure you've enabled the <extensions> otherwise Maven
won't add the bundle lifecycle to the project. Also make sure you've done
this inside <build><plugins> not <build><pluginManagement><plugins>
complete examples are available at:
http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
which also has a pointer to the FAQ
perhaps you could copy your pom.xml into an email and post it to the list?
> 2. I am supposed to do a jar which will contain 2 jars(obtained by
> splitting
> sources in two). Is it possible to do this with bundle plugin?
> -bundle.jar must contain:
> - source1.jar
> - source2.jar
> Sources are like this:
> src/main/java/sources1
> src/main/java/sources2
>
sorry, first question has to be... why? embedding jars inside a single
bundle
is possible, but this is usually when you want to embed an existing
third-party
library. I'm not sure what you gain by splitting your project into two
embedded
jars as they'd effectively be merged back together from the perspective of
the
bundle - not saying this is bad, but would like to know the use-case :)
but anyway, to do this I think you'll need to add a couple of executions of
the
maven-jar-plugin to create the two jars (you can use the includes / excludes
settings to put the right bits into each jar) - put these executions in a
phase
before the packaging step:
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
then you can use the Include-Resource bnd instruction to pull these two jars
into the bundle, and Bundle-ClassPath if you want the embedded jars to be
part of the classpath seen by the bundle (ie. if you want to load the source
as resources using the ClassLoader API)
http://www.aqute.biz/Code/Bnd#include-resource
note that the bundleplugin won't be able to create the embedded jars just
from flat files - you'll need to pack up the files first and then include
them
alternatively if you can move the sources into two separate Maven projects
then it would be a lot easier to manage - these would produce two artifacts
that you could easily embed by using Embed-Dependency (see the main
bundleplugin docs for embedding examples)
> 3. I am creating the Manifest file for the default jar with bundle plugin,
> but the problem is that this manifest appears also in sources jar (made
> with
> jar plugin using classifier tag) and I don't want this thing to happen. How
> can I avoid that?
> default = bundle.jar
> sources = source1.jar and source2.jar
>
you can customize manifests for jars created by the maven-jar-plugin:
http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html
http://maven.apache.org/shared/maven-archiver/index.html
HTH
> I will appreciate any help!
> Thank you in advance!
> --
> View this message in context:
> http://www.nabble.com/Need-help-with-maven-bundle-plugin-tp22436368p22436368.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
--
Cheers, Stuart