You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2016/08/18 14:44:20 UTC

[jira] [Commented] (FELIX-5327) SCR Plugin: FileNotFoundException in multi-module Maven reactor build in 2nd module

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

Konrad Windszus commented on FELIX-5327:
----------------------------------------

This happens only when configuring the scr plugin like this {{...;destdir=target/classes}} (it is necessary for Maven to overwrite the destdir, because the default is the folder {{bin}}) (https://github.com/apache/felix/blob/trunk/tools/org.apache.felix.scr.bnd/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java#L245).
When configuring it like this in your pom.xml it works 
{code}
...;destdir=${project.build.outputDirectory}...
{code}
It would be nice if relative paths would be better supported in Maven, but I am not sure this is easily possible because the plugin must also be supported outside Maven.

> SCR Plugin: FileNotFoundException in multi-module Maven reactor build in 2nd module
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-5327
>                 URL: https://issues.apache.org/jira/browse/FELIX-5327
>             Project: Felix
>          Issue Type: Bug
>          Components: SCR Tooling
>    Affects Versions: scr bnd plugin 1.5.0
>            Reporter: Konrad Windszus
>
> In a multi-module Maven build the scr bnd plugin tries to write the bind methods into the wrong file. Instead of {{<current maven module directory>/target/classes/...}} it tries to use {{<root maven module directory>/target/classes/...}}.
> The funny thing is that this only happens with the 2nd Maven module containing components, for the first Maven module it works correctly.
> So it seems that the scr bnd plugin is not always using the correct base path.
> The exception when this occurs looks like this
> {code}
> [ERROR] Bundle <some bundle>:<some version> : Got unexpected exception while analyzing:org.apache.felix.scrplugin.SCRDescriptorException: Unable to add methods to <Fully qualified class name of SCR Component>
> 	at org.apache.felix.scrplugin.helper.ClassModifier.addMethods(ClassModifier.java:114)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.generateMethods(SCRDescriptorGenerator.java:274)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:201)
> 	at org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin.analyzeJar(SCRDescriptorBndPlugin.java:178)
> 	at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:656)
> 	at aQute.bnd.osgi.Analyzer.analyze(Analyzer.java:209)
> 	at aQute.bnd.osgi.Builder.analyze(Builder.java:385)
> 	at aQute.bnd.osgi.Analyzer.calcManifest(Analyzer.java:687)
> 	at aQute.bnd.osgi.Builder.build(Builder.java:105)
> 	at org.apache.felix.bundleplugin.BundlePlugin.buildOSGiBundle(BundlePlugin.java:972)
> 	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:470)
> 	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:387)
> 	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:378)
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
> 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
> 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:497)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> Caused by: java.io.FileNotFoundException: <directory of root pom.xml>/target/classes/<some class containing a SCR component> (No such file or directory)
> 	at java.io.FileInputStream.open0(Native Method)
> 	at java.io.FileInputStream.open(FileInputStream.java:195)
> 	at java.io.FileInputStream.<init>(FileInputStream.java:138)
> 	at java.io.FileInputStream.<init>(FileInputStream.java:93)
> 	at org.apache.felix.scrplugin.helper.ClassModifier.addMethods(ClassModifier.java:65)
> 	... 34 more
> {code}



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