[ 
https://issues.apache.org/jira/browse/FELIX-1129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler closed FELIX-1129.
-----------------------------------

    Resolution: Won't Fix

>From the stack trace I see that you have a @scr.property referencing the 
>Importer class,so I guess you have something like "scr.property 
>nameRef="Importer.xxxx". So this error has nothing to do with the @scr.service 
>tag :)
If you use nameRef or valueRef, the class needs either to be fully qualified or 
imported; it's the same like if you would referencing this in "plain" Java.
Therefore closing the bug as invalid.

> SCR plugin fails if class import is implicit
> --------------------------------------------
>
>                 Key: FELIX-1129
>                 URL: https://issues.apache.org/jira/browse/FELIX-1129
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.0.10
>            Reporter: Alexander Klimetschek
>            Priority: Minor
>
> The scr plugin gives a build error (see below) in a certain case when an 
> import is implicit, ie. is not defined explicitly in the import section of 
> the java source file, but is referenced in the source of the superclass. The 
> interface in question is the one that this class implements and under which 
> it should be registered as service.
> In my specific case there is:
> - an interface Importer, defined in bundle A
> - an implementation of that interface, HttpImporter, also defined in bundle A
> - bundle B now has a provided dep to bundle A
> - bundle B has a class ICalHttpImporter that extends HttpImporter
> - this class has scr qdox annotations and shall be registered as service 
> under the Importer interface
> - it uses the short form @scr.service without explicitly specifying the 
> interface class name
> Because of the import of HttpImporter (and the ICalHttpImporter extends 
> HttpImporter), it is not necessary for the Java compiler to have an "import 
> com.day.cq.polling.importer.Importer" in the file (Eclipse removes it 
> automatically upon organize imports if present). But if it is missing, the 
> scr plugin fails. From the error message, it seems it is looking for the 
> interface in the current package 
> (com.day.cq.collab.calendar.impl.importer.Importer), where it cannot find it.
> If the import statement "import com.day.cq.polling.importer.Importer;" is 
> added, the scr plugin runs correctly and produces the right scrinfo files. 
> Setting priority to minor because of this workaround.
> [INFO] [scr:scr {execution: generate-scr-scrdescriptor}]
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Unable to load class com.day.cq.collab.calendar.impl.importer.Importer
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Unable to load
> class com.day.cq.collab.calendar.impl.importer.Importer
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>        at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to
> load class com.day.cq.collab.calendar.impl.importer.Importer
>        at 
> org.apache.felix.scrplugin.tags.JavaClassDescriptorManager.getJavaClassDescription(JavaClassDescriptorManager.java:383)
>        at 
> org.apache.felix.scrplugin.tags.qdox.QDoxJavaClassDescription.getExternalFieldByName(QDoxJavaClassDescription.java:175)
>        at 
> org.apache.felix.scrplugin.PropertyHandler.getReferencedField(PropertyHandler.java:258)
>        at 
> org.apache.felix.scrplugin.PropertyHandler.getPropertyName(PropertyHandler.java:210)
>        at 
> org.apache.felix.scrplugin.PropertyHandler.testProperty(PropertyHandler.java:308)
>        at 
> org.apache.felix.scrplugin.SCRDescriptorMojo.createComponent(SCRDescriptorMojo.java:268)
>        at 
> org.apache.felix.scrplugin.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:129)
>        at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
>        ... 16 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to