Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [jdt-apt-dev] using the same apt plugin in several project

Hi, Alessandro.  In general, this sort of question should be posted on the eclipse.tools.jdt newsgroup, where it will get much more readership than it could on the mailing list.  This mailing list is intended for use by people developing the Eclipse APT implementation, rather than for users of APT.
 
But I'll answer your question anyway:
 
"Yes and no."  :-)
 
Unfortunately there's no way to change the global factory path; there is also no global setting to turn on annotation processing in all projects.  This was something we considered in the initial APT design, but it led to certain ambiguities that we couldn't find good resolutions for, and at the time we didn't have a compelling use case for it, so it was shelved.  Feel free to enter it as an enhancement request (but don't get your hopes up too high unless you're also willing to contribute the code - there's not much active development happening on APT right now).
 
However, if you wrap your processor in an Eclipse plugin that extends org.eclipse.jdt.apt.annotationProcessorFactories, the extension point attributes will let you set the processor so that by default it is active in all projects.  You still need to enable annotation processing on a project by project basis, but at least the processor will be present in all enabled projects, without needing to edit the factory path.
 
Most processors are only relevant to particular project types - for instance, an EJB processor should only be on the factory path of an EJB project, you wouldn't want it to show up in a J2SE project.  So typically a project creation wizard is written to add the necessary items to the factory path and enable processing, at the time the project is created.
 
When the Eclipse APT implementation was first written, we envisioned the possibility of generic code inspection processors, that a user might want to apply to all of the Java-based projects.  However, no such processors existed at the time, and they are still quite rare, because of certain weaknesses in the APT API that tend to make it insufficient for that task.  Lacking a good use case, when we ran into problems trying to implement global enablement, we decided to leave it unimplemented.
 
Hope that helps,
  -Walter Harley
   JDT APT lead


From: jdt-apt-dev-bounces@xxxxxxxxxxx [mailto:jdt-apt-dev-bounces@xxxxxxxxxxx] On Behalf Of alessandro cinelli
Sent: Monday, June 23, 2008 6:47 AM
To: jdt-apt-dev@xxxxxxxxxxx
Subject: [jdt-apt-dev] using the same apt plugin in several project

Hi all,
I'm developing an apt plugin for my projects.
What i would like to know is if i have to specify the Factory Path in the project properties or if i can export the apt plugin globally in eclipse (as part of it) so i don't have to specifying the Factory Path in every projects.

thanks.


cirpo

Back to the top