[
https://issues.apache.org/jira/browse/FELIX-3187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13761517#comment-13761517
]
Ilya Golberg commented on FELIX-3187:
-------------------------------------
It's not the same as FELIX-2892. The problem is "@Component : Lifecycle method
activate should be declared protected"
Scala protected method compiles to java public method, so it can't be triggered
by plugin
MyActivator.scala:
@Component
class MyActivator{
protected def activate(ctx:ComponentContext){
println("Activated")
}
}
pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.13.0</version>
<configuration>
<scanClasses>true</scanClasses>
<specVersion>1.0</specVersion>
<strictMode>true</strictMode>
</configuration>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
result:
[ERROR]
PATH_TO_PROJECT\target\classes\ru\turumbay\digbox\actors\MyActivator.class
[0:0]: @Component : Lifecycle method activate should be declared protected
> scr annotations: scala support
> ------------------------------
>
> Key: FELIX-3187
> URL: https://issues.apache.org/jira/browse/FELIX-3187
> Project: Felix
> Issue Type: Bug
> Components: Maven SCR Plugin
> Reporter: Andrei Pozolotin
>
> scr annotations: scala support
> this would need to change:
> a) annotaion retention to runtime;
> b) process compiled class files, not java/scala source files - first, in the
> maven plugin;
> it is also more in line with current osgi scr annotations rfc;
> example:
> 1) scala source:
> import org.apache.felix.scr.annotations.Component
> import org.apache.felix.scr.annotations.Activate
> @Component
> class Hello {
> @Activate
> protected def activate {
>
> }
> }
> 2) class view via java decompiler:
> import org.apache.felix.scr.annotations.Activate;
> import org.apache.felix.scr.annotations.Component;
> import scala.ScalaObject;
> import scala.reflect.ScalaSignature;
> @Component
> @ScalaSignature(bytes="...")
> public class Hello
> implements ScalaObject
> {
> @Activate
> public void activate()
> {
> }
> }
> but scr maven plugin does not see it.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira