[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [jdt-apt-dev] Intro to APT, debugging APs

Hi, Michael.

Yeah, that page is pretty deeply out of date - sorry about that; one of
the items on the Eclipse 3.5 project plan is to update the web site and
add better tutorial material.

In the meanwhile, I highly recommend working through the EclipseCon 2007
tutorial that is listed on http://www.eclipse.org/jdt/apt/ .

Personally, when developing annotation processors, I like to package
them in Eclipse plug-ins, which makes debugging easier because you can
use the Eclipse plug-in development environment (PDE).  That's described
in the tutorial mentioned above.  But it is also possible to debug a
plain-vanilla annotation processor jar in Eclipse.  

The basic idea is that you have one Eclipse instance (the "host
instance") that contains the source code of the processor jar, and
perhaps also the source code of the org.eclipse.jdt.apt.core and
org.eclipse.jdt.apt.pluggable plug-ins (not necessary, but often
helpful); from this Eclipse instance, you then launch another Eclipse
instance as your debug target.  In the target instance you would have
projects containing annotated code, that your processor is going to
process; and you add your processor jar to the factory path in that
instance.  You would put breakpoints on processor code in the host
instance, and then in the target instance you build your annotated
project code, causing the processor to execute, and you'll hit the
breakpoints in the host instance.

If you make code changes to the processor code, you'll need to rebuild
the processor jar and restart the target instance, for the changes to
have an effect.  If you package the processor as a plug-in, then PDE
will take care of this for you.

If you have problems or questions, feel free to post them to the
eclipse.tools.jdt newsgroup.

  -Walter Harley
   JDT APT lead


> -----Original Message-----
> From: jdt-apt-dev-bounces@xxxxxxxxxxx 
> [mailto:jdt-apt-dev-bounces@xxxxxxxxxxx] On Behalf Of Michael Reed
> Sent: Monday, September 22, 2008 10:18 AM
> To: 'jdt-apt-dev@xxxxxxxxxxx'
> Subject: [jdt-apt-dev] Intro to APT, debugging APs
> Hi,
> I have an already-written Annotation Processor that is 
> invoked via a makefile (and apt.exe).  I'd like to be able to 
> run it in a debugger.  I'm trying to run the tutorial found 
> here, http://www.eclipse.org/jdt/apt/introToAPT.html , but it 
> requires org.eclipse.core.runtime.Plugin, which I don't have 
> & can't find anywhere.  Are there other docs that might help 
> me get started?
> Thanks much,
> Mike