[ 
https://issues.apache.org/jira/browse/FELIX-199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stuart McCulloch updated FELIX-199:
-----------------------------------

    Attachment: FELIX-199-20070328-EXTRA.patch

Hi Carlos,

When I tested the latest version of your patch I found I had additional, 
unexpected classes in the generated bundle.

  Scenario:   I want to build a simple bundle from source, which needs the OSGi 
base classes to compile
  The pom:   I add the artifact containing the OSGi base classes as a 
'provided' dependency
  Old result:   final bundle just contained my classes
  New result:   final bundle contains my classes *and* exploded OSGi base 
classes

I believe this is a side-effect of using project.getDependencyArtifacts() 
instead of project.getArtifacts() - with the old call, the dependencies were 
evaluated lazily and (as luck would have it) any artifacts in the provided 
scope didn't appear in the list at the time the plugin ran. So in my example 
the OSGi classes were used in the compilation, but not passed to bnd via 
builder.setClasspath().

With the new call, it immediately sees the direct dependencies (including the 
OSGi artifact) and adds them to the classpath passed to bnd - which then 
dutifully explodes the classes as part of the bundle process (I believe).

I have a proposed solution, which I have attached to this comment:  ignore 
dependency artifacts of type bundle

This would let users add OSGi dependencies to the compilation classpath, 
without adding them to the list of jars passed to bnd. For example:

        <dependency>
          <groupId>org.eclipse.osgi</groupId>
          <artifactId>org.eclipse.osgi</artifactId>
          <version>3.2.1</version>
          <scope>provided</scope>
          <type>bundle</type>
        </dependency>

I'm not sure if there's another way to get round this (perhaps something in 
bnd?) because sometimes you'd want the classes included (say when wrapping), 
and other times you wouldn't (say when you import and use another bundle)

Anyway, would appreciate your insight :)

> Add a recursive bundle goal to maven plugin to generate osgi bundles for all 
> dependencies
> -----------------------------------------------------------------------------------------
>
>                 Key: FELIX-199
>                 URL: https://issues.apache.org/jira/browse/FELIX-199
>             Project: Felix
>          Issue Type: New Feature
>          Components: Maven Bundle Plugin
>            Reporter: Carlos Sanchez
>         Attachments: FELIX-199-20070328-EXTRA.patch, 
> FELIX-199-20070328.patch, FELIX-199.20070325.patch, 
> org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar, recursivebundle.diff.txt
>
>
> Running
> mvn org.apache.felix:maven-bundle-plugin:recursivebundle
> in a project will convert each dependency, including transitive ones, to an 
> OSGi bundle in the target dir. It does not include dependent libraries in the 
> bundle, so each bundle matches the corresponding jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to