On Sun, 2015-10-11 at 17:09 +0200, Konrad Windszus wrote: > Hi Robert, > I just tried it out, but actually the OSGi-INF part of it is not > properly updated within Eclipse. > By looking at the according m2e plugin ( > https://github.com/tesla/m2eclipse-tycho < > https://github.com/tesla/m2eclipse-tycho>), I am not sure where the > problem is exactly. > > This is what I figured out so far: > > There is a > org.sonatype.tycho.m2e.felix.internal.MavenBundlePluginConfigurator > configured in https://github.com/tesla/m2eclipse-tycho/blob/master/or > g.sonatype.tycho.m2e/plugin.xml <https://github.com/tesla/m2eclipse-t > ycho/blob/master/org.sonatype.tycho.m2e/plugin.xml> > That returns a build participant in https://github.com/tesla/m2eclips > e > -tycho/blob/master/org.sonatype.tycho.m2e/src/org/sonatype/tycho/m2e/ > felix/internal/MavenBundlePluginConfigurator.java#L87 <https://github > .com/tesla/m2eclipse > -tycho/blob/master/org.sonatype.tycho.m2e/src/org/sonatype/tycho/m2e/ > felix/internal/MavenBundlePluginConfigurator.java#L87>. > That one executes org.apache.felix.bundleplugin.ManifestPlugin. > Obviously the ManifestPlugin does not create the scr data unless > exportScr is set to true (https://github.com/apache/felix/blob/trunk/ > tools/maven-bundle > -plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.ja > va#L80 <https://github.com/apache/felix/blob/trunk/tools/maven-bundle > -plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.ja > va#L80>). Unfortunately the exportScr is not set to true by m2eclipse > -tycho (this is probably a bug in m2eclipse-tycho). > > Also the maven-bundle-plugin does not seem to support writing the > metatype information (seems like a bug in the ManifestPlugin mojo of > the maven-bundle-plugin). > > Also I am not sure if the ManifestPlugin is called often enough by > the MavenBundlePluginConfigurator, the conditions in https://github.c > om/tesla/m2eclipse > -tycho/blob/master/org.sonatype.tycho.m2e/src/org/sonatype/tycho/m2e/ > felix/internal/MavenBundlePluginConfigurator.java#L103 <https://githu > b.com/tesla/m2eclipse > -tycho/blob/master/org.sonatype.tycho.m2e/src/org/sonatype/tycho/m2e/ > felix/internal/MavenBundlePluginConfigurator.java#L103> look wrong to > me. > E.g. if someone just adds an OSGi component class carrying some > annotations, this will not being picked up until the next full build. > Maybe that is deliberate to increase the build performance, but that > would mean not all changes lead to consistent Manifest/SCR/metatype > informations. > > Maybe someone else can confirm the observed behaviour, then I would > create bug reports for both issues.
There was a behaviour change in m2e-tycho [1] which probably accounts for this. Maybe a better way is to let go of the tycho configurator and make the maven-bundle-plugin a m2e-compatible-plugin [2]? That being said, I have not looked at the plugin internals recently so can't comment on how feasible it is. Robert [1]: https://github.com/tesla/m2eclipse-tycho/commit/85cd048ffcd4702099 2bdec2cd44f1a4945173bf [2]: https://wiki.eclipse.org/M2E_compatible_maven_plugins > Konrad > > > > On 09 Oct 2015, at 21:33, Robert Munteanu <[email protected]> > > wrote: > > > > Hi Konrad, > > > > > > > > Am 09.10.15 um 18:14 schrieb Konrad Windszus: > > > > > I experimented a bit and using something like this in my > > > > > pom.xml works pretty well. > > > > > > > > > > <plugin> > > > > > <groupId>org.apache.felix</groupId> > > > > > <artifactId>maven-bundle-plugin</artifactId> > > > > > <version>3.0.0</version> > > > > > <extensions>true</extensions> > > > > > <configuration> > > > > > <instructions> > > > > > <!-- enable processing of default OSGI component > > > > > annotations (since OSGi 5) --> > > > > > <_dsannotations>*</_dsannotations> > > > > > <!-- support inheritance on components --> > > > > > <_dsannotations-inherit>true</_dsannotations-inherit> > > > > > <!-- enable processing of default OSGI metatype > > > > > annotations (since OSGi 6) --> > > > > > <_metatypeannotations>*</_metatypeannotations> > > > > > <!-- support parsing of maven-scr-plugin annotations > > > > > through the felix.scr.bnd plugin --> > > > > > > > > > > <_plugin>org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlug > > > > > in;destdir=target/classes</_plugin> > > > > > </instructions> > > > > > </configuration> > > > > > <dependencies> > > > > > <!-- https://github.com/apache/felix/tree/trunk/tools/org.ap > > > > > ache.felix.scr.bnd --> > > > > > <dependency> > > > > > <groupId>org.apache.felix</groupId> > > > > > <artifactId>org.apache.felix.scr.bnd</artifactId> > > > > > <version>1.4.0</version> > > > > > </dependency> > > > > > </dependencies> > > > > > </plugin> > > > > > > > > > Out of curiosity, have you checked whether the m2e integration with > > Eclipse works? I'm interested in the generation of the manifest but > > also in the generation of the SCR descriptors. > > > > Thanks, > > > > Robert >
