|
|
|
[
Permlink
| « Hide
]
Jörg Hohwiller - 29/Aug/07 04:53 AM
I have the same problem/need.
On the same boat...
Have the same need too. I have the same problem - I want to extend the surefire plugin and every time I run it, I get a null-pointer exception, because the instant variables are null. According to maven-inherit plugin I have to propagate the fields using reflection. Well, propagation in my case does not work, because the fields in the surefire plugin are all private
can not access a member of class org.apache.maven.plugin.surefire.SurefirePlugin with modifiers "private" exception. Any other suggestions? FYI, you only need to propagate values using reflection if you override the field, ie. you declare a field in your mojo that "hides" a field of the same name in original mojo. You only usually need to do this if you need to change the default, or want access to the field - although in the latter case you could use reflection to read the field rather than override it. ( interestingly, if the overridden field is a @parameter then your new field will be injected instead of the original - but if it's an @component then it appears the original field is injected rather than the original )
Note that you can read and write private fields using reflection - you just need to use setAccessible(true) on the field to make it accessible, as shown in: btw, in the maven-pax-plugin I extend a number of different mojos and override a couple of private fields, so I know this works in practice. Would appreciate the implementation to use annotations with retention=RUNTIME.
S, |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||