One thing to look at is to confirm that you are *only* specifying the plugin
versions for both maven-scr-plugin and maven-bundle-plugin in the parent
POM. Maven has a bug/feature wherein it will only use one version of a given
plugin in a multi-module build, even if different versions are specified.

For example, let's say you have this structure:
P
\- A
\- B

(parent project P with submodules A and B).

A specifies version 1.0.0 of maven-xyz-plugin and B specifies version 1.1.0
of the same. When Maven is run from P, version 1.0.0 will be used for both A
and B because that is the first version to be loaded. When Maven is run from
B (or if A was commented out), version 1.1.0 would be used.

This may not be related to your issue, but when I read the line about your
"fix," this is the first thing that came to mind. Worth a quick peek at your
poms.

Justin

On Mon, Dec 28, 2009 at 12:40 PM, Guido Spadotto <[email protected]>wrote:

> Hi all,
> I'm facing a very strange behaviour that *might* be related to SCR
> (I'm not sure, so Carsten - if you're reading this - please forgive me).
>
> The project I'm working on is divided into several Maven modules.
> The modules I maintain use the maven-scr-plugin (v1.4.2)
> and the SCR Java annotations dependency (v1.2.0) to create the
> Component Descriptor and to inject OSGi services (a.k.a
> "references" in DS terms).
>
> When I build the whole project it seems that the scr goal does not generate
> the Service Component Descriptor:
>
> [INFO] Building Dgm Console
> [INFO]    task-segment: [clean, install]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [clean:clean]
> [INFO] Deleting directory C:\Users\Guido\[snipped]\DgmConsole\target
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 1 source file to
> C:\Users\Guido\[snipped]\DgmConsole\target\classes
> [INFO] [scr:scr {execution: generate-scr-scrdescriptor}]
> [INFO] [resources:testResources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile]
> [INFO] Nothing to compile - all classes are up to date
> [INFO] [surefire:test]
> [INFO] Tests are skipped.
> [INFO] [bundle:bundle]
> [ERROR] Error building bundle org.[snipped]:DgmConsole:bundle:0.3.0.2 : Not
> found Service-Component header: OSGI-INF/DgmConsole.xml
> [ERROR] Error building bundle org.[snipped]:DgmConsole:bundle:0.3.0.2 :
> Service-Component entry can not be located in JAR: OSGI-INF/DgmConsole.xml
> [ERROR] Error(s) found in bundle configuration
>
> On the other hand, if I launch the same command directly from within the
> failing module directory OR
> if I comment out all the other modules, just leaving the failing ones in
> the parent POM, it all works perfectly:
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Dgm Console
> [INFO]    task-segment: [clean, install]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [clean:clean]
> [INFO] Deleting directory C:\Users\Guido\[snipped]\DgmConsole\target
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 1 source file to
> C:\Users\Guido\[snipped]\DgmConsole\target\classes
> [INFO] [scr:scr {execution: generate-scr-scrdescriptor}]
> [INFO] Writing abstract service descriptor
> C:\Users\Guido\[snipped]\DgmConsole\target\scr-plugin-generated\OSGI-INF\scr-plugin\scrinfo.xml
> with 1 entries.
> [INFO] Generating 1 Service Component Descriptors to
> C:\Users\Guido\[snipped]\DgmConsole\target\scr-plugin-generated\OSGI-INF\DgmConsole.xml
> [INFO] [resources:testResources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile]
> [INFO] Nothing to compile - all classes are up to date
> [INFO] [surefire:test]
> [INFO] Tests are skipped.
> [INFO] [bundle:bundle]
> [INFO] [install:install]
> [INFO] Installing
> C:\Users\Guido\[snipped]\DgmConsole\target\DgmConsole-0.3.0.2.jar to
> C:\Users\Guido\.m2\repository\[snipped]\DgmConsole\0.3.0.2\DgmConsole-0.3.0.2.jar
> [INFO] [bundle:install]
> [INFO] Parsing file:/C:/Users/Guido/.m2/repository/repository.xml
> [INFO] Installing [snipped]/DgmConsole/0.3.0.2/DgmConsole-0.3.0.2.jar
> [INFO] Writing OBR metadata
>
>
> The failing modules are "leaves" in the dependency tree, so they're built
> last
> (don't know if this is meaningful, just shooting in the dark).
>
> I can provide more logs if required.
>
>
> Thank you,
> Guido
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to