Attempting to migrate a <packaging>jar</packaging> project to
<packaging>osgi-bundle</packaging> using the OSGi plugin,  but stumbled
upon a problem with maven transitive dependencies.

The <packaging>jar</packaging> project I am migrating has a set of pom
dependencies already defined as:

<dependencies>
    <dependency>
      <groupId>groupA</groupId>
      <artifactId>artifact1</artifactId>
      <version>0.7.4.2</version>
    </dependency>

    <dependency>
      <groupId>groupB</groupId>
      <artifactId>artifact2</artifactId>
      <version>${pom.version}</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.0</version>
      <scope>provided</scope>
    </dependency>

  </dependencies>

Note: Maven assigns a default scope of compile to artifact1 and
artifact2, flagging artifact1 and artifact2 as transitive deps.


To change this pom.xml to support OSGi, I changed the packaging to:
<packaging>osgi-bundle</packaging>, added a maven-osgi-plugin definition
and added <scope>provided</scope> to the artifact1 and artifact2
dependencies.

Problem:
When using the OSGi plugin it is necessary to change the scope to
'provided' on artifact1 and artifact2 in order to prevent those jars
from being added to the created bundle artifact. But changing the scope
to provided no longer assigns artifact1 and artifact2 as transitive
dependencies.  This has the side effect of breaking other projects that
are picking up artifact1 and artifact2 transitively from this project's
pom.

Is there a way that these artifacts can be excluded from the bundle and
still retain their transitive relationship to the project? 

thanks,

John

Reply via email to