[ 
https://issues.apache.org/jira/browse/FELIX-4009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15205427#comment-15205427
 ] 

Stefan Seifert commented on FELIX-4009:
---------------------------------------

i've contributed another PR with further improvements on this issue:
https://github.com/apache/felix/pull/60

this fixes the "big number of compilations/maven builds where one would be 
sufficient" issue together with old-style felix SCR annotations. additionally 
it adds a flag {{supportIncrementalBuild}} to the {{manifest}} goal which 
defaults to "false", so performance implications on incremental builds may only 
occur if this is switched to true (which is required of course if you want to 
profit from SCR incremental builds). additionally i added a simple check before 
starting the incremental build to run it only if any *.java file was added, 
updated or removed since last build. detection changes on the pom.xml did not 
work, eclipse project clean may be required in this case.

i think those both contributions are a useful addition to the maven scr plugin. 
it adds a sensible default m2e configuration, although some manual work is 
required to get support of incremental builds and running osgi-mock based unit 
tests (see below).

still, the solution is not optimal - some background information:
# for the usecase for generating the required SCR metadata before the unit test 
run these have to be generated before the unit tests are executed (this is also 
true for a command line build, not only in Eclipse). this is the reason why 
using only the {{bundle}} goal does not work, one has to define an explicit 
additionally {{manifest}} goal as well - example:
{code:xml}
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <extensions>true</extensions>
          <executions>
            <execution>
              <id>scr-metadata</id>
              <goals>
                <goal>manifest</goal>
              </goals>
              <configuration>
                <supportIncrementalBuild>true</supportIncrementalBuild>
              </configuration>
            </execution>
          </executions>
...
{code}
this is tedious and has to be well documented. and in practice on a normal 
build the manifest and SCR files are generated twice - once for the manifest 
goal and once for the bundle goal. the reason is that the bndlib does not 
differ between those usecases internally.
# generation of the SCR metadata seems to be a bit faster with the 
maven-scr-plugin than with the maven bundle plugin/bndlib. the reason is that 
bndlib does much more magic on manifest generation, and generating the SCR 
metadata is more a side-product of this call.
# but the biggest issue is that the bndlib currently does not support 
incremental generation. it always does the full job, analyzes all classes, does 
all magic, generates all SCR metadata using all configured bnd plugins. i see 
no easy way to add support for this in bndlib with the API as-is. so this is a 
bit of blocker for further improvements in this area.
# i see no possibilities to step between the plugin and bndlib and apply any 
improvements like robert suggested 
[here|https://issues.apache.org/jira/browse/FELIX-4009?focusedCommentId=15194952#comment-15194952].

after encountering those issues i was thinking about an easy alternative: the 
source of the problem was supporting the new OSGi R6 annotation which are 
currently support by bndlib, but not by the maven-scr-plugin. perhaps we should 
just add support for them in maven-scr-plugin which has very good incremental 
support in eclipse and is stable, and do not use bndlib for this until it has 
better support for incremental building.

> maven bundle plugin should be integrated directly with eclipse
> --------------------------------------------------------------
>
>                 Key: FELIX-4009
>                 URL: https://issues.apache.org/jira/browse/FELIX-4009
>             Project: Felix
>          Issue Type: New Feature
>          Components: Maven Bundle Plugin
>    Affects Versions: maven-bundle-plugin-2.3.7
>            Reporter: Andrei Pozolotin
>            Assignee: Carsten Ziegeler
>              Labels: m2e
>             Fix For: maven-bundle-plugin-3.0.2
>
>
> Stuart:
> 1) currently, to integrate maven-bundle-plugin into m2e, one must  use tycho 
> configurator
> https://github.com/sonatype/m2eclipse-tycho
> which adds needles complexity, and makes few strange assumptions
> https://github.com/sonatype/m2eclipse-tycho/blob/master/org.sonatype.tycho.m2e/src/org/sonatype/tycho/m2e/internal/OsgiBundleProjectConfigurator.java#L74
> which no one it seems is there to care to correct
> https://github.com/sonatype/m2eclipse-tycho/pull/8
> 2) instead, I suggest maven-bundle-plugin to provide direct integration with 
> eclipse via
> http://wiki.eclipse.org/M2E_compatible_maven_plugins#BuildContext
> which I would expect to be more customizable / flexible for the end user.
> I recently made similar switch with my DS plugin, and life got easier :-)
> https://github.com/carrot-garden/carrot-maven/tree/master/carrot-maven-scr-plugin
> thanks.
> Andrei.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to