Discussion:
Future of maven-scr-plugin
(too old to reply)
Konrad Windszus
2015-10-07 15:37:41 UTC
Permalink
Hi,
I am wondering about the future of the maven-scr-plugin. I think it should be deprecated and instead the documentation should point to the maven-bundle-plugin to be used now even for generating descriptors for metatype and declarative services.

That can nowadays take care of generating the component descriptor [0] with the OSGi standard annotations [1]. For the metatype generation bnd came up with its own annotations[3], which should be a replacement for all maven-scr-plugin annotations.
Also it seems that maven-scr-plugin is not compatible with Declarative Services 1.3 (meaning I cannot use "Configuration Property Types”) [3].

The only thing which is not covered in the maven-bundle-plugin is component inheritance (but that is deprecated anyways [4]).
Are there any other feature of the maven-scr-plugin which are not covered by bnd/maven-bundle-plugin?

My request originates from the discussion at https://github.com/bndtools/bnd/issues/999.

WDYT?
Thanks for any input,
Konrad


[0] - http://www.aqute.biz/Bnd/Components
[1] - https://osgi.org/javadoc/r6/enterprise/org/osgi/service/component/annotations/package-summary.html
[2] - http://www.aqute.biz/Bnd/MetaType
[3] - http://njbartlett.name/2015/08/17/osgir6-declarative-services.html
[4] - https://issues.apache.org/jira/browse/FELIX-4170
Carsten Ziegeler
2015-10-07 16:18:32 UTC
Permalink
Hi
Post by Konrad Windszus
Hi,
I am wondering about the future of the maven-scr-plugin. I think it should be deprecated and instead the documentation should point to the maven-bundle-plugin to be used now even for generating descriptors for metatype and declarative services.
That can nowadays take care of generating the component descriptor [0] with the OSGi standard annotations [1]. For the metatype generation bnd came up with its own annotations[3], which should be a replacement for all maven-scr-plugin annotations.
Actually there are standard metatype annotations as well which work
nicely with the new R6 DS annotations. So no need to use proprietary
annotations anymore
Post by Konrad Windszus
Also it seems that maven-scr-plugin is not compatible with Declarative Services 1.3 (meaning I cannot use "Configuration Property Types”) [3].
It only supports DS upto 1.2
Post by Konrad Windszus
The only thing which is not covered in the maven-bundle-plugin is component inheritance (but that is deprecated anyways [4]).
That's why we deprecated it :)
Post by Konrad Windszus
Are there any other feature of the maven-scr-plugin which are not covered by bnd/maven-bundle-plugin?
Nearly none - we have default properties in the scr plugin, so you can
configure something like the vendor once in your parent pom and it gets
applied to every component.

The plan is to indeed phase out the maven scr plugin. It still has some
usage, as the bundle plugin is not a dropin replacement. You would need
to rewrite your components - and switching to the official annotations
has some subtle differences in the defaults.
On the other hand, we have a bnd plugin that is able to process the
proprietary Felix annotations.

Therefore, I totally agree that we should update the documentation. But
of course we have to support our user base for some time.

Carsten
Post by Konrad Windszus
My request originates from the discussion at https://github.com/bndtools/bnd/issues/999.
WDYT?
Thanks for any input,
Konrad
[0] - http://www.aqute.biz/Bnd/Components
[1] - https://osgi.org/javadoc/r6/enterprise/org/osgi/service/component/annotations/package-summary.html
[2] - http://www.aqute.biz/Bnd/MetaType
[3] - http://njbartlett.name/2015/08/17/osgir6-declarative-services.html
[4] - https://issues.apache.org/jira/browse/FELIX-4170
--
Carsten Ziegeler
Adobe Research Switzerland
***@apache.org
David Jencks
2015-10-07 16:31:39 UTC
Permalink
can’t you add the -dsannotations-inherit: true flag to the maven-bundle-plugin instructions and get DS inheritance?

david jencks
Post by Carsten Ziegeler
Hi
Post by Konrad Windszus
Hi,
I am wondering about the future of the maven-scr-plugin. I think it should be deprecated and instead the documentation should point to the maven-bundle-plugin to be used now even for generating descriptors for metatype and declarative services.
That can nowadays take care of generating the component descriptor [0] with the OSGi standard annotations [1]. For the metatype generation bnd came up with its own annotations[3], which should be a replacement for all maven-scr-plugin annotations.
Actually there are standard metatype annotations as well which work
nicely with the new R6 DS annotations. So no need to use proprietary
annotations anymore
Post by Konrad Windszus
Also it seems that maven-scr-plugin is not compatible with Declarative Services 1.3 (meaning I cannot use "Configuration Property Types”) [3].
It only supports DS upto 1.2
Post by Konrad Windszus
The only thing which is not covered in the maven-bundle-plugin is component inheritance (but that is deprecated anyways [4]).
That's why we deprecated it :)
Post by Konrad Windszus
Are there any other feature of the maven-scr-plugin which are not covered by bnd/maven-bundle-plugin?
Nearly none - we have default properties in the scr plugin, so you can
configure something like the vendor once in your parent pom and it gets
applied to every component.
The plan is to indeed phase out the maven scr plugin. It still has some
usage, as the bundle plugin is not a dropin replacement. You would need
to rewrite your components - and switching to the official annotations
has some subtle differences in the defaults.
On the other hand, we have a bnd plugin that is able to process the
proprietary Felix annotations.
Therefore, I totally agree that we should update the documentation. But
of course we have to support our user base for some time.
Carsten
Post by Konrad Windszus
My request originates from the discussion at https://github.com/bndtools/bnd/issues/999.
WDYT?
Thanks for any input,
Konrad
[0] - http://www.aqute.biz/Bnd/Components
[1] - https://osgi.org/javadoc/r6/enterprise/org/osgi/service/component/annotations/package-summary.html
[2] - http://www.aqute.biz/Bnd/MetaType
[3] - http://njbartlett.name/2015/08/17/osgir6-declarative-services.html
[4] - https://issues.apache.org/jira/browse/FELIX-4170
--
Carsten Ziegeler
Adobe Research Switzerland
Konrad Windszus
2015-10-07 16:33:23 UTC
Permalink
Hi Carsten,
thanks for your answer. One other thing to mention here is that custom plugins exist for the maven-scr-plugin (http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/extending-scr-annotations.html <http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/extending-scr-annotations.html>).
Could those be easily migrated to bnd plugins? Do you have any hints on how to accomplish that for @SlingServlet, @SlingFilter (currently part of maven-scr-plugin, but should be moved to a Sling module then) and for @SlingHealthCheck (https://github.com/apache/sling/blob/trunk/bundles/extensions/healthcheck/annotations/src/main/java/org/apache/sling/hc/annotations/SlingHealthCheckProcessor.java <https://github.com/apache/sling/blob/trunk/bundles/extensions/healthcheck/annotations/src/main/java/org/apache/sling/hc/annotations/SlingHealthCheckProcessor.java>)?
Thanks
Konrad
Post by Carsten Ziegeler
Hi
Post by Konrad Windszus
Hi,
I am wondering about the future of the maven-scr-plugin. I think it should be deprecated and instead the documentation should point to the maven-bundle-plugin to be used now even for generating descriptors for metatype and declarative services.
That can nowadays take care of generating the component descriptor [0] with the OSGi standard annotations [1]. For the metatype generation bnd came up with its own annotations[3], which should be a replacement for all maven-scr-plugin annotations.
Actually there are standard metatype annotations as well which work
nicely with the new R6 DS annotations. So no need to use proprietary
annotations anymore
Post by Konrad Windszus
Also it seems that maven-scr-plugin is not compatible with Declarative Services 1.3 (meaning I cannot use "Configuration Property Types”) [3].
It only supports DS upto 1.2
Post by Konrad Windszus
The only thing which is not covered in the maven-bundle-plugin is component inheritance (but that is deprecated anyways [4]).
That's why we deprecated it :)
Post by Konrad Windszus
Are there any other feature of the maven-scr-plugin which are not covered by bnd/maven-bundle-plugin?
Nearly none - we have default properties in the scr plugin, so you can
configure something like the vendor once in your parent pom and it gets
applied to every component.
The plan is to indeed phase out the maven scr plugin. It still has some
usage, as the bundle plugin is not a dropin replacement. You would need
to rewrite your components - and switching to the official annotations
has some subtle differences in the defaults.
On the other hand, we have a bnd plugin that is able to process the
proprietary Felix annotations.
Therefore, I totally agree that we should update the documentation. But
of course we have to support our user base for some time.
Carsten
Post by Konrad Windszus
My request originates from the discussion at https://github.com/bndtools/bnd/issues/999.
WDYT?
Thanks for any input,
Konrad
[0] - http://www.aqute.biz/Bnd/Components
[1] - https://osgi.org/javadoc/r6/enterprise/org/osgi/service/component/annotations/package-summary.html
[2] - http://www.aqute.biz/Bnd/MetaType
[3] - http://njbartlett.name/2015/08/17/osgir6-declarative-services.html
[4] - https://issues.apache.org/jira/browse/FELIX-4170
--
Carsten Ziegeler
Adobe Research Switzerland
Konrad Windszus
2015-10-09 16:14:09 UTC
Permalink
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.SCRDescriptorBndPlugin;destdir=target/classes</_plugin>
</instructions>
</configuration>
<dependencies>
<!-- https://github.com/apache/felix/tree/trunk/tools/org.apache.felix.scr.bnd -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.bnd</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</plugin>

But while migrating from Felix SCR annotations to official OSGi annotations I just came across another issue:
Bnd in contrast to maven-scr-plugin will not generate bind methods for fields annotated with @Reference (although @Reference is being allowed in fields since OSGi DS 1.3). I opened a bug on that at https://github.com/bndtools/bnd/issues/1148. Maybe someone can comment on whether that is a bug in Bnd or the DS Plugin in Bnd was never supposed to modify existing class files (to add the bind method). That is not clear from the spec (at least to me).
This feature would be an important difference to the maven-scr-plugin as writing those bind methods manually is a lot more verbose…
Konrad
Post by Konrad Windszus
Hi Carsten,
thanks for your answer. One other thing to mention here is that custom plugins exist for the maven-scr-plugin (http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/extending-scr-annotations.html <http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/extending-scr-annotations.html>).
Thanks
Konrad
Post by Carsten Ziegeler
Hi
Post by Konrad Windszus
Hi,
I am wondering about the future of the maven-scr-plugin. I think it should be deprecated and instead the documentation should point to the maven-bundle-plugin to be used now even for generating descriptors for metatype and declarative services.
That can nowadays take care of generating the component descriptor [0] with the OSGi standard annotations [1]. For the metatype generation bnd came up with its own annotations[3], which should be a replacement for all maven-scr-plugin annotations.
Actually there are standard metatype annotations as well which work
nicely with the new R6 DS annotations. So no need to use proprietary
annotations anymore
Post by Konrad Windszus
Also it seems that maven-scr-plugin is not compatible with Declarative Services 1.3 (meaning I cannot use "Configuration Property Types”) [3].
It only supports DS upto 1.2
Post by Konrad Windszus
The only thing which is not covered in the maven-bundle-plugin is component inheritance (but that is deprecated anyways [4]).
That's why we deprecated it :)
Post by Konrad Windszus
Are there any other feature of the maven-scr-plugin which are not covered by bnd/maven-bundle-plugin?
Nearly none - we have default properties in the scr plugin, so you can
configure something like the vendor once in your parent pom and it gets
applied to every component.
The plan is to indeed phase out the maven scr plugin. It still has some
usage, as the bundle plugin is not a dropin replacement. You would need
to rewrite your components - and switching to the official annotations
has some subtle differences in the defaults.
On the other hand, we have a bnd plugin that is able to process the
proprietary Felix annotations.
Therefore, I totally agree that we should update the documentation. But
of course we have to support our user base for some time.
Carsten
Post by Konrad Windszus
My request originates from the discussion at https://github.com/bndtools/bnd/issues/999.
WDYT?
Thanks for any input,
Konrad
[0] - http://www.aqute.biz/Bnd/Components
[1] - https://osgi.org/javadoc/r6/enterprise/org/osgi/service/component/annotations/package-summary.html
[2] - http://www.aqute.biz/Bnd/MetaType
[3] - http://njbartlett.name/2015/08/17/osgir6-declarative-services.html
[4] - https://issues.apache.org/jira/browse/FELIX-4170
--
Carsten Ziegeler
Adobe Research Switzerland
Carsten Ziegeler
2015-10-09 16:40:42 UTC
Permalink
Post by 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.SCRDescriptorBndPlugin;destdir=target/classes</_plugin>
</instructions>
</configuration>
<dependencies>
<!-- https://github.com/apache/felix/tree/trunk/tools/org.apache.felix.scr.bnd -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.bnd</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</plugin>
This feature would be an important difference to the maven-scr-plugin as writing those bind methods manually is a lot more verbose…
This is not a bug, the new DS version directly manipulates the field and
does not rely an bind methods. The maven.scr.plugin needed to go this
way to be compatible with the previous DS spec.

Regards
Carsten
--
Carsten Ziegeler
Adobe Research Switzerland
***@apache.org
Konrad Windszus
2015-10-09 17:46:34 UTC
Permalink
It turned out to be a wrong class path due to a transitive dependency from felix.scr.bnd. I opened https://issues.apache.org/jira/browse/FELIX-5074 <https://issues.apache.org/jira/browse/FELIX-5074> about that!
Post by Carsten Ziegeler
Post by 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.SCRDescriptorBndPlugin;destdir=target/classes</_plugin>
</instructions>
</configuration>
<dependencies>
<!-- https://github.com/apache/felix/tree/trunk/tools/org.apache.felix.scr.bnd -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.bnd</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</plugin>
This feature would be an important difference to the maven-scr-plugin as writing those bind methods manually is a lot more verbose

This is not a bug, the new DS version directly manipulates the field and
does not rely an bind methods. The maven.scr.plugin needed to go this
way to be compatible with the previous DS spec.
Regards
Carsten
--
Carsten Ziegeler
Adobe Research Switzerland
Robert Munteanu
2015-10-09 19:33:12 UTC
Permalink
Hi Konrad,
Post by 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.SCRDescriptorBndPlugin;destdir=target/classes</_plugin>
</instructions>
</configuration>
<dependencies>
<!-- https://github.com/apache/felix/tree/trunk/tools/org.apache.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
Konrad Windszus
2015-10-11 15:09:49 UTC
Permalink
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/org.sonatype.tycho.m2e/plugin.xml <https://github.com/tesla/m2eclipse-tycho/blob/master/org.sonatype.tycho.m2e/plugin.xml>
That returns a build participant in https://github.com/tesla/m2eclipse-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.java#L80 <https://github.com/apache/felix/blob/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java#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.com/tesla/m2eclipse-tycho/blob/master/org.sonatype.tycho.m2e/src/org/sonatype/tycho/m2e/felix/internal/MavenBundlePluginConfigurator.java#L103 <https://github.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.
Konrad
Post by Robert Munteanu
Hi Konrad,
Post by 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.SCRDescriptorBndPlugin;destdir=target/classes</_plugin>
</instructions>
</configuration>
<dependencies>
<!-- https://github.com/apache/felix/tree/trunk/tools/org.apache.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
Robert Munteanu
2015-10-13 12:47:14 UTC
Permalink
Post by Konrad Windszus
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.
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
Post by Konrad Windszus
Konrad
Post by Robert Munteanu
Hi Konrad,
Post by 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
Continue reading on narkive:
Loading...