felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stuart McCulloch" <stuart.mccull...@jayway.net>
Subject Re: maven-bundle-plugin not resolving transitive dependencies
Date Tue, 11 Sep 2007 10:39:37 GMT
On 11/09/2007, aldana@gmx.de <aldana@gmx.de> wrote:
>
> hi,
>
> i am using maven-bundle-plugin to build a osgi bundle (which is a great
> bridge between maven-dependency management and osgi).
>
> for importing i am using <Private-Package>, which includes all maven
> dependencies. the first level dependency artifacts (see
> commons-httpclient) get included but the transitive dependencies (as
> commons-httpclient --->commons-coded) not. is that a bug or do i need to
> enable this option somewhere?


I've tried your pom with the latest plugin code in trunk (1.1.0-SNAPSHOT)
and I get the transitive dependencies inside the bundle, so this problem is
fixed, but is not yet available in a released plugin

btw, the 1.1.0-SNAPSHOT plugin also provides a more controllable approach
to embedding dependencies (https://issues.apache.org/jira/browse/FELIX-308)
which I'd recommend over Private-Package:*, as this can lead to unexpected
contents as it drags in the whole classpath

case in point:

   <Private-Package>*,!org.eclipse.equinox</Private-Package>

is the same as just using * because the negation is after the wildcard

using:

   <Private-Package>!org.eclipse.equinox,*</Private-Package>

would not add classes in the org.eclipse.equinox package - however,
the equinox bundle actually contains classes from org.eclipse.osgi.*
and org.osgi.* so this would be better:

  <Private-Package>!org.eclipse*,!org.osgi*,*</Private-Package>

but using the FELIX-308 functionality is a little clearer:

  <Embed-Transitive>true</Embed-Transitive>
  <Embed-Dependency>
    *;groupId=!org.eclipse.equinox;inline=true
  </Embed-Dependency>

you can also now ask Bnd to export the contents of the bundle without
needing to know the packages in advance, which is useful for wrapping:

  <_exportcontents>*</_exportcontents>

HTH

you can reproduce described behaviour by using following pom (though do
> not forget to provide an implementation of  Activator). just do a 'mvn
> package'. have a look at the generated target/xxx.jar and you will see
> that org.apache.commons.codec does not get included.
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>    <modelVersion>4.0.0</modelVersion>
>    <groupId>osgi.try</groupId>
>    <artifactId>a</artifactId>
>    <packaging>bundle</packaging>
>    <version>1.0</version>
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.apache.felix</groupId>
>                <artifactId>maven-bundle-plugin</artifactId>
>                <version>1.0.0</version>
>                <extensions>true</extensions>
>                <configuration>
>                    <instructions>
>
> <Private-Package>*,!org.eclipse.equinox</Private-Package>
>                        <Bundle-Activator>Activator</Bundle-Activator>
>                    </instructions>
>                </configuration>
>            </plugin>
>        </plugins>
>    </build>
>    <dependencies>
>        <dependency>
>            <groupId>org.eclipse.equinox</groupId>
>            <artifactId>osgi</artifactId>
>            <version>3.1.1</version>
>        </dependency>
>        <dependency>
>            <groupId>commons-httpclient</groupId>
>            <artifactId>commons-httpclient</artifactId>
>            <version>3.0.1</version>
>            <optional>true</optional>
>        </dependency>
>    </dependencies>
> </project>
>
> thanks for your answer in advance.
>
> --
> manuel aldana
> aldana@gmx.de
> www.aldana-online.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message