vancetang / reflections

Automatically exported from code.google.com/p/reflections
Do What The F*ck You Want To Public License
0 stars 0 forks source link

Reflections is not producing any XML for method annotations, only for class annotations #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, when I run my build, an XML file is written which has 
<TypeAnnotationsScanner> element listing all the classes having a particular 
annotation, but there is no <MethodAnnotationsScanner> or 
<FieldAnnotationsScanner> element written.  I can successfully enumerate 
annotated classes at runtime, but when I try to enumerate annotated methods or 
fields, I get nothing, presumably because the XML file has no metadata for 
annotated methods or fields.  What do I need to do to get reflections to 
produce the XML for annotated methods and fields so that the 
getMethodsAnnotatedWith() and getFieldsAnnotatedWith() methods work instead of 
returning nothing?

I added the reflections-maven plugin to my build as follows.  Is there some 
additional information I must code for the maven plugin to get method and field 
information to be gathered?
Thanks

     <plugin>
                <groupId>org.reflections</groupId>
                <artifactId>reflections-maven</artifactId>
                <version>0.9.8</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>reflections</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
          </plugin>
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by nmerritt...@gmail.com on 22 Aug 2012 at 12:40

GoogleCodeExporter commented 9 years ago
the reason is that scanners defaults to TypeAnnotationsScanner and 
SubTypesScanner, otherwise specify in the configuration:

<execution>
    ...
    <configuration>
        <scanners>TypeAnnotationsScanner, SubTypesScanner, FieldAnnotationsScanner, MethodAnnotationsScanner</scanners>
    </configuration>
</execution>

see 
http://reflections.googlecode.com/svn/trunk/reflections-maven/javadoc/apidocs/or
g/reflections/maven/plugin/ReflectionsMojo.html#scanners

Original comment by ronm...@gmail.com on 22 Aug 2012 at 5:52

GoogleCodeExporter commented 9 years ago
Thanks very much!

Original comment by nmerritt...@gmail.com on 22 Aug 2012 at 4:38

GoogleCodeExporter commented 9 years ago

Original comment by ronm...@gmail.com on 20 Feb 2013 at 9:08