1

I am using today maven-bundle-plugin to generate the manifest of my projects. Due to others constraints, my modules use the "jar" packaging (i can't use the "bundle" packaging), and currently, my pom look like this :

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
      <archive>  
        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
      </archive> 
   </configuration>
</plugin>     
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <executions>
    <execution>
      <id>bundle-manifest</id>
      <phase>process-classes</phase>
      <goals>
        <goal>manifest</goal>
      </goals>
      <configuration>
        <instructions>
         ...
        </instructions>
      </configuration>
    </execution>
  </executions> 
</plugin>   

I'd like now to generate a 'Service-Component' header and the DS xml descriptor from my annotated components, but adding "<_dsannotations>*</_dsannotations>" is not working :

  1. Service-Component header is correctly generated, but the xml are not present in the jar
  2. If i rebuild my maven project without a clean goal, then the 'Service-Component' header have duplicates references : After digging in the code, the plugin use the old generated manifest from target/classes/META-INF/MANIFEST.MF and merge it with the new generated one. The 'Service-Component' is then concatened

So, how should i configure my pom for this to work ? For now, i use the 'unpackBundle' option (in order to have the xml in my bundle) and an empty src/main/resource/MANIFEST.MF (in order to bypass the merge of the old manifest) : it looks ugly :-)

Moreover, the 'bnd-maven-plugin' work as intended, but the integration with maven are maybe too light (or not documented?), as 'global configuration' in a parent pom, generation of the Bundle-SymbolicName or Bundle-Name, etc.

Thanks!

Jérémie B
  • 10,611
  • 1
  • 26
  • 43
  • The `bnd-maven-plugin` does indeed work as you want, so why not use it? Can you be clearer about what your concerns are? – Neil Bartlett Jan 21 '16 at 13:44
  • What i would like to keep from the maven-bundle-plugin: Global configuration in the parent pom, like a "_removeheader" directive, version policy, etc ; configuring the Bundle-SymbolicName from ${groupId}.${actifactId}, configuring the Bundle-Name from the project name, and probably others default i didn't see yet. I have more than 500 bundles to change (and others dependencies maintened by others peoples), and using a set of default value and maven properties in the bnd directive could help me :-) – Jérémie B Jan 21 '16 at 14:01
  • All these things can be done in the parent `bnd.bnd` file, and potentially overridden in the `bnd.bnd` of individual projects. – Neil Bartlett Jan 22 '16 at 19:47
  • thanks, i didn't know that. one last question : how is the "parent bnd" resolved ? can it be automatically downloaded from a maven repository ? all my projects have a "corporate" parent pom with a set of default properties, it's not in the local filesystem (it looks related to the issue 952 on github, but which is closed) – Jérémie B Jan 22 '16 at 20:46
  • The parent bnd file is in the parent Maven project. I don't know how you can have a parent Maven project that is not in the filesystem, so I can't answer that part of your question. – Neil Bartlett Jan 22 '16 at 22:37
  • The parent is referenced by groupId/artifactId/version : maven download it like any other dependencies. For exemple all apache projets use a "org.apache/apache" pom. It's the "maven way" to provide corporate default configuration – Jérémie B Jan 23 '16 at 08:07
  • Okay the best thing is probably to try it, if it doesn't work then report as a bug and we will fix it. Better yet, raise a PR! – Neil Bartlett Jan 23 '16 at 08:10
  • Thanks for yours answers - this issue already exist : [#952](https://github.com/bndtools/bnd/issues/952) - see [this comment](https://github.com/bndtools/bnd/issues/952#issuecomment-106581131) – Jérémie B Jan 23 '16 at 11:29

1 Answers1

1

There is a newer plugin for maven that is closer to both bnd and maven. This plugin does not take over the jar target and properly follows the maven phases.

Take a look at http://njbartlett.name/2015/03/27/announcing-bnd-maven-plugin.html

Peter Kriens
  • 15,196
  • 1
  • 37
  • 55
  • i have seen it, and it's look very promising, but i can't find now "standard feature" of the maven-bundle-plugin as global configuration (parent pom?) or the configuration of the Bundle-SymbolicName from the groupId, etc. – Jérémie B Jan 21 '16 at 13:58