You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Bernardo Carneiro <Be...@fastsearch.com> on 2007/10/19 15:20:06 UTC
build eclipse plugin using maven-bundle-plugin
Hi,
I´m trying to build and eclipse plugin using maven-bundle-plugin but I'm not able to compile my classes under src/main/java using it.
Is there a way to do so with the maven-bundle-plugin?
[]s,
Bernardo
Re: build eclipse plugin using maven-bundle-plugin
Posted by Stuart McCulloch <st...@jayway.net>.
On 20/10/2007, Bernardo Carneiro <Be...@fastsearch.com> wrote:
>
>
> Hi Stuart,
>
> What I wanted was to replace the maven-pde-plugin - as it does not
> handle dependencies well - with the maven-bundle-plugin so I could build
> with maven an eclipse plugin I´m developing.
>
>
>
> <dependencies>
> <dependency>
> <groupId>com.fastsearch.kat</groupId>
> <artifactId>kat-core</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>com.fastsearch.ccr.facalib</groupId>
> <artifactId>facalib</artifactId>
> <version>5.1.1.163</version>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Export-Package>com.fastsearch.rext.*</Export-Package>
^ ok, this Export-Package instruction will pull the
com.fastsearch.rext.*classes into the bundle
( Bnd uses Export-Package, Private-Package and Include-Resource to decide
which classes and
resources to pull into the final bundle - it doesn't include anything from
target/classes unless
you list the package as an Export-Package / Private-Package )
<Bundle-SymbolicName>${pom.artifactId
> }</Bundle-SymbolicName>
> <Bundle-Activator>${pom.groupId
> }.annotator.AnnotatorPluginActivator</Bundle-Activator>
> <Embed-Directory>lib</Embed-Directory>
> <Embed-StripGroup>true</Embed-StripGroup>
>
> <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
^ this Embed-Dependency instruction will make the bundle-plugin add
Include-Resource clauses
and Bundle-ClassPath entries to embed those two dependencies - looking at
the package names
I suspect you will end up with duplication of classes in the final bundle as
you're both embedding
them and declaring them on Export-Package, which will also pull the classes
into the bundle
to set the bundle exports without pulling in the classes you should use
another Bnd instruction:
<_exportcontents>com.fastsearch.rext.*</_exportcontents>
this takes effect _after_ Bnd has assembled the bundle.
sorry if this is confusing, but Bnd was originally written to use a "pull"
approach to ensure bundles
are valid, which is why setting Export-Package drags classes in that are
also embedded later on...
the embedding instructions act as a pre-processing step to bridge between
Maven dependencies
and the Bnd tool (Bnd can also act as an Ant task, command-line tool and
Eclipse plugin)
if you want to export classes from src/main/java as well as classes from
embedded jars you could
use something like the following approach:
<Export-Package>some.local.pkgs</Export-Package>
<_exportcontents>some.local.pkgs, some.embedded.pkgs</_exportcontents>
or if you don't mind the classes being inlined (ie. not in a sub-jar), just
use Export-Package and
remove any embed instructions. Similarly use Private-Package to include any
classes that you
want in the bundle, but don't want to make public.
</instructions>
> </configuration>
> </plugin>
> </plugins>
> </build>
if you still have build problems, just post a message with the error /
exception logs and I'll take a look.
PS. you might want to look at my Pax-Construct tools which can help generate
Maven projects and Bnd
settings using simple Windows/Unix scripts (ie. pax-create-project to create
a project, pax-create-bundle
to add a simple bundle, pax-embed-jar to embed another jar, pax-wrap-jar to
turn a jar into a bundle...)
http://www.ops4j.org/projects/pax/construct/index.html
any questions on Pax-Construct can be posted to the general OPS4J mailing
list (http://lists.ops4j.org/mailman/listinfo/general)
HTH
-----Original Message-----
> From: mcculls@gmail.com [mailto:mcculls@gmail.com] On Behalf Of Stuart
> McCulloch
> Sent: sexta-feira, 19 de outubro de 2007 12:04
> To: users@felix.apache.org
> Subject: Re: build eclipse plugin using maven-bundle-plugin
>
> On 19/10/2007, Bernardo Carneiro <Be...@fastsearch.com> wrote:
> >
> > Hi,
> >
> > I´m trying to build and eclipse plugin using maven-bundle-plugin but I'm
> > not able to compile my classes under src/main/java using it.
> >
> > Is there a way to do so with the maven-bundle-plugin?
>
>
> Hi Bernado,
>
> the maven-bundle-plugin doesn't compile classes - it analyzes classes
> compiled by Maven to add OSGi metadata
>
> could you provide more information about the problem you see (ie.
> exceptions, output from 'mvn clean install -X')
> and perhaps also post a sample of your POM... should be inline text, as
> the
> mailing list removes any attachments
>
> []s,
> >
> > Bernardo
> >
>
> --
> Cheers, Stuart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Cheers, Stuart
RE: build eclipse plugin using maven-bundle-plugin
Posted by Bernardo Carneiro <Be...@fastsearch.com>.
Hi Stuart,
What I wanted was to replace the maven-pde-plugin - as it does not handle dependencies well - with the maven-bundle-plugin so I could build with maven an eclipse plugin I´m developing.
<dependencies>
<dependency>
<groupId>com.fastsearch.kat</groupId>
<artifactId>kat-core</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.fastsearch.ccr.facalib</groupId>
<artifactId>facalib</artifactId>
<version>5.1.1.163</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>com.fastsearch.rext.*</Export-Package>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Bundle-Activator>${pom.groupId}.annotator.AnnotatorPluginActivator</Bundle-Activator>
<Embed-Directory>lib</Embed-Directory>
<Embed-StripGroup>true</Embed-StripGroup>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
-----Original Message-----
From: mcculls@gmail.com [mailto:mcculls@gmail.com] On Behalf Of Stuart McCulloch
Sent: sexta-feira, 19 de outubro de 2007 12:04
To: users@felix.apache.org
Subject: Re: build eclipse plugin using maven-bundle-plugin
On 19/10/2007, Bernardo Carneiro <Be...@fastsearch.com> wrote:
>
> Hi,
>
> I´m trying to build and eclipse plugin using maven-bundle-plugin but I'm
> not able to compile my classes under src/main/java using it.
>
> Is there a way to do so with the maven-bundle-plugin?
Hi Bernado,
the maven-bundle-plugin doesn't compile classes - it analyzes classes
compiled by Maven to add OSGi metadata
could you provide more information about the problem you see (ie.
exceptions, output from 'mvn clean install -X')
and perhaps also post a sample of your POM... should be inline text, as the
mailing list removes any attachments
[]s,
>
> Bernardo
>
--
Cheers, Stuart
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: build eclipse plugin using maven-bundle-plugin
Posted by Stuart McCulloch <st...@jayway.net>.
On 19/10/2007, Bernardo Carneiro <Be...@fastsearch.com> wrote:
>
> Hi,
>
> I´m trying to build and eclipse plugin using maven-bundle-plugin but I'm
> not able to compile my classes under src/main/java using it.
>
> Is there a way to do so with the maven-bundle-plugin?
Hi Bernado,
the maven-bundle-plugin doesn't compile classes - it analyzes classes
compiled by Maven to add OSGi metadata
could you provide more information about the problem you see (ie.
exceptions, output from 'mvn clean install -X')
and perhaps also post a sample of your POM... should be inline text, as the
mailing list removes any attachments
[]s,
>
> Bernardo
>
--
Cheers, Stuart