Hmm, I've had a quick go at trying this but encountered the following problems:

- the tools.jar dependency needs to be added in order to obtain the
process(AnnotationProcessorFactory, PrintWriter, String...) method,
since reflection requires AnnotationProcessorFactory.class

- adding tools.jar as a dependency causes test failures, I'm assuming
due to classloader issues although I haven't got time to dig deeper

Feel free to provide a patch that provides your necessary hook that
also passes all the tests, just raise a JIRA issue and I'll take a
look.

Cheers,

Mark

On 23/04/2008, Mark Hobson <[EMAIL PROTECTED]> wrote:
> Hi Luke,
>
>
>  On 23/04/2008, Luke Patterson <[EMAIL PROTECTED]> wrote:
>  > This post continues a discussion from a direct email sent yesterday.  I was
>  > directed to move this discussion to the mailing list.
>  >
>  > I asked about opening up the API to allow better programmatic access to
>  > com.sun.tools.apt.Main:
>  >
>  > > Have you considered opening up another method on AptUtils which looks
>  > > something like this:
>  > >
>  > >     public static boolean invoke( Log log, AnnotationProcessorFactory 
> apf,
>  > > List args ) throws MojoExecutionException
>  >  >
>  > >     or if you are concerned about compile-time dependencies
>  > >
>  > >     public static boolean invoke( Log log, Object apf, List args )
>  > > throws MojoExecutionException
>  > >
>  > >
>  > > The new 'invoke' method would use
>  >  >
>  > com.sun.tools.apt.Main#process(AnnotationProcessorFactory,String[]).
>  >
>  > Portion of committer's initial response:
>  >
>  > > I'm curious as to how you're actually using
>  > > apt-maven-plugin in your own plugin, are you just bringing it in as a
>  > > dependency and using AptUtils directly?
>  >
>  >
>  > My response:
>  > Yeah, I was hoping to call AptUtils directly from my plugin.  I'm working 
> on
>  > an annotation-based plugin which helps eliminate some POM configuration and
>  > synchronization tasks.  For example, it would understand annotations like
>  > @ServiceProvider for creating jar-spec Service Provider entries.  It would
>  > also understand annotations which help configure Bnd tool for creating OSGi
>  > metadata, e.g. @NonPublicApi for setting class exclusion filters.
>  >
>  > Anyway, if that method was added, I could hand apt an
>  > AnnotationProcessorFactory which is in context of my mojo.  Would you be
>  > willing to look at some patches I had in mind?
>
>
> No problem, I can change AptUtils accordingly for you.  A few points
>  we might like to consider in future:
>
>  - move AptUtils into API and JDK implementation modules like
>  plexus-compiler [1], this would facilitate alternative implementations
>  like eclipse apt
>
>  - configure your factory using environment options to avoid having to
>  pass an instance in
>
>  Is your plugin hosted anywhere yet or is it under development?
>
>  Cheers,
>
>  Mark
>
>  [1] http://svn.codehaus.org/plexus/plexus-components/trunk/plexus-compiler/
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to