How to make M2E eclipse plugin understand Bundle p

2019-04-24 03:01发布

I'm almost new with Osgi. I'm using Eclipse 3.6 Helios for building my first Felix Bundle but find out that M2E don't understand bundle packaging...

Project build error: Unknown packaging: bundle

Project build error: Unresolveable build extension: 
Plugin org.apache.felix:maven-bundle-plugin:2.0.0 or one of its dependencies could not be resolved: 
Failed to collect dependencies for org.apache.felix:maven-bundle-plugin:jar:2.0.0 ()

As I done google searches, it was an error in Maven 2 but fixed in Maven 3 with M2E using.

Also, I'm using Window XP and under a proxy, which I think I sussefully config it, other connections in Eclipse work fine...

So I don't know how to get M2E understand bundle packaging ?

2条回答
三岁会撩人
2楼-- · 2019-04-24 03:31

Using these settings, import the maven project. If there are missing connectors (which links maven goals and eclipse plugins), the 'Next' button should be enabled. Do Next and auto-resolve the connectors to install tycho plugins. From now on, your project will have a Plugin nature.

P.S Be sure to at least have one class to compile in the project or maven-bundle-plugin will complain.

<packaging>bundle</packaging>
<build>
<plugins>
    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.7</version>
        <extensions>true</extensions>
    </plugin>
</plugins>

查看更多
Juvenile、少年°
3楼-- · 2019-04-24 03:48

Justy FYI, ebelanger's answer above led me down the right direction. If you're not seeing the eclipse popup prompting for resolving connections, you need to add the parent pom that declares the plugin to eclipse.

In my case I had a child pom project I was importing into eclipse (but not the parent pom). Note that the actual plugin decleragion for maven-bundle-plugin was in the parent pom, not the child pom eclipse was aware of.

With just the child imported, Eclipse's build problems panel showed the errors about not being able to find the maven-bundle-plugin dependency, but the "quick fix" option after right clicking on the error in the problems panel was greyed out.

Importing the parent project into eclipse caused it to pop up the prompt asking for eclipse plugin connectors to install to support the maven-bundle-plugin.

查看更多
登录 后发表回答