Eclipse overwrites manifest created by maven bundle plugin

9ilsdx 9rvj 0lo

I'm using maven-bundle-plugin to generate MANIFEST.MF for OSGi container.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Export-Package>com.example.mypackage</Export-Package>
                </instructions>
            </configuration>
            <executions>
                <execution>
                    <id>bundle-manifest</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>manifest</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

However, that manifest file got destroyed (overwritten) by Eclipse (4.6.1 Neon) after, f.g Maven/Update Project or Clean/Build.

Is it possible to make Eclipse somehow aware of the maven plugins, and not destroy their output? What should I setup to prevent that (mis)behaviour?

If that issue is not to be fixed with Eclipse, does it work better with IntelliJ, for example? OSGi support within IDE is quite important for me...

Christian Schneider

I have to change my answer. I missed the part that you define the goal manifest. This is the new and recommended way to use the maven bundle plguin but it requires that you tell the jar plugin to use the existing Manifest.

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <archive>
                    <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                </archive>
            </configuration>
        </plugin>

old answer

I suspect you are using the Eclipse PDE. The PDE is always working Manifest first. This means it is incompatible with the maven-bundle-plugin.

I recommend to use a plain maven build which we use a lot at apache projects like Apache Karaf or Apache Aries. It lacks the special OSGi support of Eclipse PDE but this sucks anyway.

You can augment this by using the eclipse plugin bndtools. Bndtools now provides maven support to a degree. This means you can now provide maven based OBR indexes for your project and define which bundles to start in a bndrun file. This allows to directly start and debug your OSGi project in Eclipse. See the osgi-chat example on how to do it.

Beware though that bndtools just started with maven support recently. So the current version 3.3.0 still lacks some of the convenience for maven builds.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

maven bundle plugin configuration

From Dev

maven-javadoc-plugin overwrites central repository

From Dev

Jenkins maven plugin alters manifest

From Dev

How do I fix manifest-update lifecycle error of android-maven-plugin in Eclipse?

From Dev

Maven Plugin dependencies included in MANIFEST.MF

From Dev

Maven Plugin dependencies included in MANIFEST.MF

From Dev

Maven Bundle Plugin: Export has private references

From Dev

How to give an output directory in maven bundle plugin

From Dev

Which Maven bundle plugin should be used

From Dev

OSGi with Maven bundle plugin not loading library

From Dev

Eclipse plugin project not consuming OSGI bundle dependencies

From Dev

Maven does not generate a MANIFEST file with maven jar plugin

From Dev

how to use maven bundle plugin to exclude package out of bundle

From Dev

Handling split packages: Require-Bundle with maven-bundle-plugin

From Dev

Handling split packages: Require-Bundle with maven-bundle-plugin

From Dev

How to configure a manifest file of a jar file by using the maven assembly plugin?

From Dev

Eclipse - manifest.mf plugin dependencies - different icons

From Dev

Eclipse: Maven Module missing artifact - .jar not created

From Dev

Unable to open a newly created Maven project in eclipse

From Dev

unable to start the bundle created using maven archetype in apache karaf

From Dev

Install maven 3.1.1 plugin for eclipse juno

From Dev

Maven plugin "mark invalid" in Eclipse (Mars - 4.5.0)

From Dev

maven-surefire-plugin missing in eclipse

From Dev

Typical Maven Deploy Plugin for Nexus from Eclipse

From Dev

Creating a Site Using Eclipse Maven Plugin

From Dev

Maven M2Eclipse plugin not working

From Dev

Eclipse Project with Scala Plugin, Maven and Spark

From Dev

jbake plugin requires maven upgrade in eclipse

From Dev

maven-bundle-plugin Creates unexpected Import-Package content

Related Related

  1. 1

    maven bundle plugin configuration

  2. 2

    maven-javadoc-plugin overwrites central repository

  3. 3

    Jenkins maven plugin alters manifest

  4. 4

    How do I fix manifest-update lifecycle error of android-maven-plugin in Eclipse?

  5. 5

    Maven Plugin dependencies included in MANIFEST.MF

  6. 6

    Maven Plugin dependencies included in MANIFEST.MF

  7. 7

    Maven Bundle Plugin: Export has private references

  8. 8

    How to give an output directory in maven bundle plugin

  9. 9

    Which Maven bundle plugin should be used

  10. 10

    OSGi with Maven bundle plugin not loading library

  11. 11

    Eclipse plugin project not consuming OSGI bundle dependencies

  12. 12

    Maven does not generate a MANIFEST file with maven jar plugin

  13. 13

    how to use maven bundle plugin to exclude package out of bundle

  14. 14

    Handling split packages: Require-Bundle with maven-bundle-plugin

  15. 15

    Handling split packages: Require-Bundle with maven-bundle-plugin

  16. 16

    How to configure a manifest file of a jar file by using the maven assembly plugin?

  17. 17

    Eclipse - manifest.mf plugin dependencies - different icons

  18. 18

    Eclipse: Maven Module missing artifact - .jar not created

  19. 19

    Unable to open a newly created Maven project in eclipse

  20. 20

    unable to start the bundle created using maven archetype in apache karaf

  21. 21

    Install maven 3.1.1 plugin for eclipse juno

  22. 22

    Maven plugin "mark invalid" in Eclipse (Mars - 4.5.0)

  23. 23

    maven-surefire-plugin missing in eclipse

  24. 24

    Typical Maven Deploy Plugin for Nexus from Eclipse

  25. 25

    Creating a Site Using Eclipse Maven Plugin

  26. 26

    Maven M2Eclipse plugin not working

  27. 27

    Eclipse Project with Scala Plugin, Maven and Spark

  28. 28

    jbake plugin requires maven upgrade in eclipse

  29. 29

    maven-bundle-plugin Creates unexpected Import-Package content

HotTag

Archive