BTW, one way to exclude transitive dependencies at the moment is:
1A) specify wrapped jars as dependencies with 'runtime' scope and
use the maven-dependency-plugin to copy them into a directory
called 'lib' ... the dependency plugin has an excludeTransitive
option to not copy the extra jars, but they'll still get downloaded.
or...
1B) use the maven-dependency-plugin to copy named artifacts to
a directory called lib (no excludeTransitive is needed for this)
This has the benefit of not downloading the extra jars, but the
maven-eclipse-plugin won't add them to the generated classpath.
2) use the following instructions in the maven-bundle-plugin:
<Include-Resource>lib=lib</Include-Resource>
<Bundle-ClassPath>lib/${wrapped.artifactId}-${project.version}.jar</Bundle-ClassPath>
where wrapped.artifactId is a property set inside the pom
This should wrap the original jarfile inside the OSGi bundle (ie. no unpacking).
Cheers, Stuart
On 09/03/07, Stuart McCulloch <[EMAIL PROTECTED]> wrote:
Hi Michael,
If the original jar has dependencies with 'compile' scope then they're added to
the build classpath and packaged in the final bundle. This may or may not be
what you want - some jars have dependencies that form a collective module
and would never appear separately, so you'd like those dependencies added.
Other jars have dependencies that could be shared among a lot of bundles
(ie. jdbc) - in that case you'd make a separate bundle of the dependency and
would not want it added to the parent jar (to avoid classpath issues & bloat).
If you decide to not include a dependency inside a bundle, you should probably
declare the import as optional using ";resolution:=optional".
Cheers, Stuart
On 09/03/07, Hampel, Michael <[EMAIL PROTECTED]> wrote:
>
> Hello Alin,
>
> I don't understand why you would have to exclude the dependencies - as far as
I
> Understood the maven-bundle plugin is not doing anything with the maven
dependencies.
> If the dependencies are excluded (like in the hibernate osgi pom) and I add
the hibernate
> Osgi jar as a dependency to my project, I would loose the transitive
capability of maven as the
> Transitive dependencies of hibernate are not added anymore, e.g.: when doing
eclipse:eclipse.
> On the other side it makes sense to exclude the dependencies, because I also
will have to wrap the
> Hibernate dependencies to become osgi bundles - so the jta dependencies will
change to a jta-osgi dependency....
> Does this mean I have to forget about maven's transitive capabilites?
>
> Maybe I am thinking completely wrong here - but probably you could shed some
light,
>
> Thanx,
>
> Michael
>
>
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Alin Dreghiciu [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 08. März 2007 14:18
> An: [email protected]
> Betreff: maven-bundle-plugin, wrapping and excludeTransitive
>
> About jar wrapping:
>
> Most of the time (at least in the cases I had) you would like to wrap only
> the content of the jar you are targeting and not also the transitive
> dependencies that the targeted jar has. You can do this in at least two
> ways:
> 1. add <exclusions> to the dependency. This is verbose for the case that the
> targeted jar has extensive dependencies and irrelevant to the process of
> wrapping
> 2. set the Export-package directive to export only those packages that you
> want. here you have to know the internals of the package and if the jar has
> some resources as licences, xmls' outside the main package you have to add
> them one by one.
>
> So, here I am proposing a new configuration option: excludeTransitive that
> is suppose to exclude the transitive artifacts if set to true.
>
> An example implementation can be found at the following location:
>
http://maven.apache.org/plugins/maven-dependency-plugin/xref/org/apache/maven/plugin/dependency/utils/filters/TransitivityFilter.html
>
> Alin Dreghiciu
>
> PS. Maven does not support a property of the articat as isTransitive()
>
>
<http://maven.apache.org/plugins/maven-dependency-plugin/xref/org/apache/maven/plugin/dependency/utils/filters/TransitivityFilter.html>
>