On 28/11/2007, Elvy <[EMAIL PROTECTED]> wrote:
>
>
> Let's be clear...
>
> "export" is in manifest for the OSGi framework to know about the packages
> you provide
> "packaged" is the inclusion inside the bundle (inlined or not)
>
> Since I first want to understand the mecanics, I though of exporting
> nothing
> (for the moment) but I would like to package the uo library so my code can
> access its classes.
the embed functionality is not available in the 1.0.0 release - it is only
available
in the 1.1.0-SNAPSHOT, which is available from the apache snapshot
repository
as well as the OPS4J snapshot repository:
<pluginRepositories>
<pluginRepository>
<id>ops4j-snapshots</id>
<url>http://repository.ops4j.org/mvn-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
(the benefit of using OPS4J is that it doesn't have all the other plugin
snapshots)
if you want to export your service package, keep the rest private, and embed
the
uo library then I'd use something like:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.1.0-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-Name>Tactical Editor Bundle</Bundle-Name>
<Bundle-Version>${pom.version}</Bundle-Version>
<!-- export the public api -->
<Export-Package>com.thalesgroup.osgi.services</Export-Package>
<!-- add the implementation -->
<Private-Package>com.thalesgroup.osgi</Private-Package>
<Bundle-Activator>com.thalesgroup.osgi.Activator
</Bundle-Activator>
<!-- note: use default import setting (ie. *) -->
<!-- embed any compile or runtime dependencies -->
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Directory>target/dependency</Embed-Directory>
<Embed-StripGroup>true</Embed-StripGroup>
</instructions>
</configuration>
</plugin>
although my own preference is to put the public API in a higher package (ie.
com.foo)
and put any implementation code in com.foo.internal - some people like
com.foo.impl
also keep the Import-Package as the default (ie. *) and Bnd will calculate
it from the
bundle contents... of course you want to add additional version information,
or make
some imports optional then you need to set it - but I always keep the * at
the end in
case I've missed out on an import
I'd then add the uo library as an optional compile scope dependency
<dependency>
<groupId>uo</groupId>
<artifactId>uo</artifactId>
<version>1.0.6</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
which would then be embedded and kept private
HTH - the plan is to release the current bundle-plugin snapshot by the end
of the year...
Kit Plummer-4 wrote:
> >
> > By exported do you mean not packaged in the jar? If so, just add:
> >
> > <scope>provided</scope>
> >
> > to the <dependency/>.
> >
> > If you mean not exported in the MANIFEST - I think it is not by default.
> >
> > Kit
> >
> > On Nov 28, 2007, at 7:37 AM, Elvy wrote:
> >
> >>
> >> Hi,
> >>
> >> I'm new to OSGi and hence, new to the maven-bundle-plugin (2 weeks of
> >> reading).
> >>
> >> I keep on reading posts/docs and can't get the bundle-plugin to
> >> create an
> >> (dummy) osgi bundle.
> >>
> >> Let's say I have the following java structure:
> >> com/
> >> thalesgroup/
> >> osgi/
> >> Activator.java
> >> services/
> >> DummyServiceI.java
> >>
> >> and I require "uo-1.0.6.jar" (which is a maven project).
> >>
> >> First, I would like the bundle to have its uo dependance not exported
> >> (inlined or not).
> >> I also need the osgi core jar at compilation but since it is
> >> exported by
> >> Felix, it's not needed in the bundle.
> >>
> >> Here's my pom
> >>
> >>
> __________________________________________________________________________________________
> >> <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>
> >> <name>Stars Tactical Editor OSGi Bundle</name>
> >> <groupId>com.thalesgroup.osgi</groupId>
> >> <artifactId>tacticaleditor-bundle</artifactId>
> >> <version>0.1-SNAPSHOT</version>
> >> <packaging>bundle</packaging>
> >>
> >> <dependencies>
> >> <dependency>
> >> <groupId>com.thalesgroup.stars</groupId>
> >> <artifactId>uo</artifactId>
> >> <version>1.0.6</version>
> >> </dependency>
> >> <dependency>
> >> <groupId>org.osgi</groupId>
> >> <artifactId>osgi-core</artifactId>
> >> <version>4.1</version>
> >> <!--<scope>provided</scope>-->
> >> <optional>true</optional>
> >> </dependency>
> >> </dependencies>
> >>
> >> <build>
> >> <plugins>
> >> <plugin>
> >> <groupId>org.apache.maven.plugins</groupId>
> >> <artifactId>maven-compiler-plugin</artifactId>
> >> <configuration>
> >> <source>1.5</source>
> >> <target>1.5</target>
> >> </configuration>
> >> </plugin>
> >> <plugin>
> >> <groupId>org.apache.felix</groupId>
> >> <artifactId>maven-bundle-plugin</artifactId>
> >> <version>1.0.0</version>
> >> <extensions>true</extensions>
> >> <configuration>
> >> <manifestLocation>META-INF</manifestLocation>
> >> <instructions>
> >> <Bundle-Name>Tactical Editor Bundle</Bundle-
> >> Name>
> >> <Bundle-Version>${pom.version}</Bundle-Version>
> >> <Embed-Dependency>*;inline=true</Embed-
> >> Dependency>
> >> <_exportcontents>*</_exportcontents>
> >> <Import-Package>org.osgi.framework</Import-
> >> Package>
> >>
> >> <Export-Package>com.thalesgroup.osgi.services</Export-Package>
> >> <!-- to find the Activator -->
> >>
> >> <Private-Package>com.thalesgroup.osgi</Private-Package>
> >>
> >> <Bundle-Activator>com.thalesgroup.osgi.Activator</Bundle-Activator>
> >> <Embed-Directory>target/dependency</Embed-
> >> Directory>
> >> <Embed-StripGroup>true</Embed-StripGroup>
> >> </instructions>
> >> </configuration>
> >> </plugin>
> >> <plugin>
> >> <artifactId>maven-dependency-plugin</artifactId>
> >> <executions>
> >> <execution>
> >> <phase>package</phase>
> >> <configuration>
> >>
> >> <!--<outputDirectory>${project.build.directory}/dependency</
> >> outputDirectory>-->
> >> </configuration>
> >> <goals>
> >> <goal>unpack-dependencies</goal>
> >> </goals>
> >> </execution>
> >> </executions>
> >> </plugin>
> >> </plugins>
> >> </build>
> >> </project>
> >>
> __________________________________________________________________________________________
> >>
> >> Can you guys please help me getting started? There are a few guiding
> >> docs
> >> out there but they lack the little thing that will get the beginner
> >> up and
> >> running.
> >>
> >> Thanks in advance.
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/getting-started-but-maven-bundle-plugin-tf4888903.html#a13993464
> >> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/getting-started-with-maven-bundle-plugin-tf4888903.html#a13994649
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Cheers, Stuart