Eclipse error with osgi + maven + maven-pax-plugin

I am trying to create an OSGi package and integrate it into eclipse. I am using maven-pax-plugin to create packages. These are the steps that I follow.

I am creating an osgi project using pax

mvn org.ops4j:maven-pax-plugin:create-project -DgroupId=org.sonatype.mcookbook -DartifactId=osgi-project -Dversion=1.0-SNAPSHOT 

and then create the package

 mvn pax:create-bundle -Dpackage=org.sonatype.mcookbook -Dname=osgi-bundle -Dversion=1.0-SNAPSHOT 

and then try to import the maven project into eclipse (file / import / existing maven project), the package project created in the second step always gives me this error

 maven-pax-plugin:1.5:compile (1 error) Execution default-compile, in org.sonatype.mcookbook/pom.xml maven-pax-plugin:1.5:testCompile (1 error) Execution default-testCompile, in org.sonatype.mcookbook/pom.xml 

When I select one of the errors, the description says

 No marketplace entries found to handle Execution default-compile, in org.sonatype.mcookbook/pom.xml in Eclipse. Please see Help for more information. 

If I ignore the error and import the project, anyway this is what eclipse complains about

 Plugin execution not covered by lifecycle configuration: org.ops4j:maven-pax-plugin:1.5:compile (execution: default-compile, phase: compile) 

Has anyone seen this? any ideas how to fix this? I am following this tutorial but adding integration with eclipse. Please note that if I create it using maven and do not use eclipse, all this works fine, the problem is in eclipse / m2e

I am using Eclipse Indigo SR2 and m2e 1.0.200

+4
source share
2 answers

Newer versions of m2eclipse require that every plugin that affects the build is supported with the m2eclipse plugin. Therefore, maven-pax-plugin is not yet supported. Since this mainly happens with most maven plugins, I still use the old version of m2eclipse. Unfortunately, downloading the old version 0.12 seems to have been recently removed. You may need to wait while the maven-pax plugin is supported.

+3
source

I will get rid of this problem by following the comment in the generated POM and move <extensions>true</extensions> down to the maven-bundle plan below, specifying:

  ... <plugins> <plugin> <groupId>org.ops4j</groupId> <artifactId>maven-pax-plugin</artifactId> <version>1.4</version> <!-- | enable improved OSGi compilation support for the bundle life-cycle. | to switch back to the standard bundle life-cycle, move this setting | down to the maven-bundle-plugin section --> <!-- WAS HERE --> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>1.4.3</version> <!-- | the following instructions build a simple set of public/private | classes into an OSGi bundle --> <extensions>true</extensions> <!-- MOVED HERE :-) --> <configuration> ... 

Then update the project (right-click on the project name in Project Explorer: Maven → Update Project ...), wait until the build is complete and an error occurs.

Hope this helps!

+6
source

All Articles