You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Stuart McCulloch <st...@jayway.net> on 2008/03/07 05:56:20 UTC

Re: Maven Bundle + Eclipse RCP

On 30/01/2008, Fabio Braga de Oliveira <fa...@simula.com.br> wrote:
>
> Hi again!
>
> In my quest to integrate maven + Eclipse RCP, I did the follow:
>
> 1) I downloaded and unzipped the
> eclipse-rcp-europa-fall2-linux-gtk-x86_64.tar.gz file from the
> eclipse.org website.
>
> 2) I executed the eclipse:to-maven task, using the maven-eclipse-plugin:
> mvn eclipse:to-maven
> -DeclipseDir=/home/fbdo/Applications/eclipse-rcp/eclipse-maven
>
> where /home/fbdo/Applications/eclipse-rcp/eclipse-maven is the directory
> path where I unzipped the file from step 1.
>
> 3) In my Eclipse RCP project, I created a new pom.xml file, as Stuart
> suggested above. And I added the Eclipse RCP dependencies and others,
> some of them was created in step 2, as a result of importing the eclipse
> bundles to the local repository. I'm sending the resulting pom.xmlattached.
>
> 4) Finally, I executed the command:
>
> mvn clean eclipse:clean package eclipse:eclipse -Declipse.pde install
>
> as Stuart also suggested.
>
> Probably is my fault, but the resulting project doesn't compile in the
> eclipse workspace. The plug-in dependencies are linked to my old target
> platform, and  some dependencies aren't resolved at all. I'm sending a
> print screen with what I'm seeing.


<< didn't see any screenshot, I think it was scrubbed by the mailing list >>

remember that Eclipse/PDE only knows about the entries in the .classpath
generated by the maven-eclipse-plugin - and the "eclipse:eclipse" goal will
assume provided or OSGi dependencies are supplied by the Eclipse/PDE
"pluginDependencies" classpath container (when the pde flag is enabled).

so if you look at the generated .classpath file you should see entries for
src
and test directories, as well as some entries starting with M2_REPO, which
refer to files in your local maven repository (usually non-OSGi test/compile
depedencies) - but the provided/OSGi dependencies will not be there

I'm assuming you've already set the M2_REPO classpath variable to point
to the repository on your machine - if not then you can set it manually, or
get the eclipse plugin to do it for you:

   mvn -Declipse.workspace=<path-to-eclipse-workspace>
eclipse:add-maven-repo

so Eclipse should find any non-OSGi compile dependencies - it's just that
the provided / OSGi dependencies are expected to come from your target
platform (because with OSGi, you don't really care who ends up supplying
a package...)

If any one has a clue, I will be very thankful for your help.


basically, check the M2_REPO setting in Eclipse and expect to use the
target platform for any OSGi dependencies not in your local project(s),

you could also try my modified eclipse mojo which may/may not help:

   mvn org.ops4j:maven-pax-plugin:eclipse

it tries to produce a more workable .classpath for when your target
platform doesn't contain those plug-ins/bundles available to maven.

HTH

Thanks again!
>
> Stuart McCulloch wrote:
>   > On 29/01/2008, Fabio Braga de Oliveira <fa...@simula.com.br> wrote:
>   >> Hi list!
>   >
>   >
>   > Hi Fabio,
>   >
>   > Anyone did a sucessful build of a eclipse plugin, using the
>   >> maven-bundle-plugin?
>   >
>   >
>   > yes :)
>   >
>   > If yes, can you share the pom.xml or some tips of
>   >> how to do? Or the right direction? I'm trying right now, but some
> pieces
>   >> doesn't work very well. Some tips of what to do with the plugin.xml,
>   >> build.properties and the MANIFEST.MF files, how to put in the right
>   >> position to use the PDE tools are welcome.
>   >
>   >
>   > 1) to get the MANIFEST.MF file in the right place you can use the
>   > manifestLocation setting:
>   >
>   >       <plugin>
>   >         <groupId>org.apache.felix</groupId>
>   >         <artifactId>maven-bundle-plugin</artifactId>
>   >         <version>1.2.0</version>
>   >         <extensions>true</extensions>
>   >         <!--
>   >           the following instructions build a simple set of
> public/private
>   > classes into an OSGi bundle
>   >         -->
>   >         <configuration>
>   >           <manifestLocation>META-INF</manifestLocation>
>   >           <instructions>
>   >             <!--
>   >               ...your specific BND instructions to create the
> bundle...
>   >             -->
>   >           </instructions>
>   >         </configuration>
>   >       </plugin>
>   >
>   > 2) to get the plugin.xml file (stored in the project root) into your
> final
>   > bundle, use:
>   >
>   >     <resources>
>   >       <resource>
>   >         <directory>src/main/resources</directory>
>   >       </resource>
>   >       <resource>
>   >         <directory>.</directory>
>   >         <includes>
>   >           <include>plugin.xml</include>
>   >         </includes>
>   >       </resource>
>   >     </resources>
>   >
>   > and the bundleplugin will include it automatically to the right place
> in the
>   > bundle.
>   >
>   > 3) you don't actually need a build.properties file as maven is
> building the
>   > bundle
>   >
>   > 4) to create the Eclipse project metadata use:
>   >
>   >    mvn clean package eclipse:eclipse -Declipse.pde install
>   >
>   > (note the install after the eclipse goal is to fix the manifest,
> because the
>   > eclipse plugin
>   >  can corrupt it by adding a blank line in the middle of the file
> rather than
>   > at the end...)
>   >
>   > you should now be able to import your new plugin into Eclipse as an
> existing
>   > project.
>   > (read http://maven.apache.org/plugins/maven-eclipse-plugin for other
> useful
>   > goals)
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart