To: Sisu project community <sisu-users@xxxxxxxxxxx>
From: Stuart McCulloch
Sent by: sisu-users-bounces@xxxxxxxxxxx
Date: 08/28/2015 01:40PM
Subject: Re: [sisu-users] Annotation processor not picking custom qualifiers
Hi Gian,
This works for me locally with a simple setup, could you provide more details about your pom.xml? Perhaps a public project that recreates the issue?
Is the library containing MyQualifier a compile dependency of the project where you’re doing the index? The indexer needs access to the annotation bytecode to verify it is a qualifier.
Also note that the APT6 annotation processor behaves slightly differently to the sisu-maven-plugin for performance reasons (because it’s automatically triggered when you compile using Java6+ with Sisu on the project classpath). By default it only looks for @Named, as this is very fast given the information immediately available in APT, but you can tell it to look for other qualifiers with the “qualifiers” option:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<compilerArgs>
<arg>-Aqualifiers=ALL</arg>
</compilerArgs>
</configuration>
</plugin>
--
Cheers, Stuart
On Friday, 28 August 2015 at 09:25, gian.maria.romanato@xxxxxxxxxxxx wrote:
Hello,
I have a custom qualifier defined as follows:
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
public @interface MyQualifier {
}
@MyQualifier
public class MyComponent {
}
And I am using the sisu annotation processor in the maven build of my osgi application to produce the Named index:
<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.3.0</version>
<executions>
<execution>
<id>index-dependencies</id>
<phase>package</phase>
<goals>
<goal>index</goal>
</goals>
<configuration>
<!-- same include/exclude settings as maven-dependency-plugin -->
</configuration>
</execution>
</executions>
</plugin>
It turns out that classes annotated @Named show up in the index, while classes annotated @MyQualifier don't.
What am I doing wrong? This was tricky to find out because in development I am using BeanScanning=ON
while when deploying the final application I am using BeanScanning=INDEX under the assumption that the APT
would list in the index file also classes featuring my custom qualifier.
_______________________________________________
sisu-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit