You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Stuart McCulloch <mc...@gmail.com> on 2008/09/02 19:43:20 UTC

Re: maven-bundle-plugin and system scoped dependencies...

2008/6/14 Mark Derricutt <ma...@talios.com>

> 'lo all,
>
> Is the maven-bundle-plugin supposed to work with system scoped
> dependencies?  I have in my pom.xml:
>
>  <dependency>
>   <groupId>com.jetbrains</groupId>
>   <artifactId>annotations</artifactId>
>   <version>8.o-8460</version>
>   <scope>system</scope>
>   <systemPath>${basedir}/lib/jetbrains-annotations.jar</systemPath>
>  </dependency>
>
> and later:
>
> <Export-Package>myutils.util.*,org.jetbrains.annotations</Export-Package>
>
> but the bundle plugin keeps reporting "Superfluous export-package
> instructions".  This seems to work fine for non-system scoped
> dependencies...
>

This seems to be a quirk of Maven - when we call project.getArtifacts()
to discover the project dependencies, it does not include system scope
dependencies

it may be that they're being filtered out by this Maven plugin setting:

  @requiresDependencyResolution runtime

  [ http://maven.apache.org/developers/mojo-api-specification.html ]

this is required to get deterministic builds, otherwise the plugin will get
whatever project dependencies were resolved by the previous plugin
which could vary according to the build profile

this setting has been there for a long time (before I started helping out)
and I haven't had time / the urge to investigate changing it to use "test",
which might help - unfortunately Maven doesn't support setting it to be
"provided", which would be ideal...

in the meantime, here's a possible workaround:

   <!-- pull in local classes -->
   <Export-Package>myutils.util.*</Export-Package>

   <!-- embed direct system scope dependencies -->
   <Embed-Dependency>*;scope=system</Embed-Dependency>
   <Embed-Transitive>false</Embed-Transitive>

   <!-- add/update export directive, without changing contents -->
   <_exportcontents>org.jetbrains.annotations</_exportcontents>

this works because the embed dependency feature uses a different
Maven API in non-transitive mode (project.getDependencyArtifacts)
which only returns the direct project dependencies, and it appears
that system scoped dependencies are not filtered for this method

HTH


> Mark
>
> --
> "It is easier to optimize correct code than to correct optimized code." --
> Bill Harlan
>

-- 
Cheers, Stuart