A little more info; sorry it's been a while since I've looked at the
apt plugin.  The apt mojo attempts to add the tools.jar URL to the
system classloader via reflection, which I'm guessing is failing in
Eclipse.

>From what I can remember, apt refuses to work properly if it is not
loaded by the system classloader, so we can't take the approach used
in plexus-compiler-javac where a new classloader is constructed.

Any suggestions welcome on how to make this Eclipse friendly :)

Cheers,

Mark

2009/2/27 Mark Hobson <markhob...@gmail.com>:
> Hi there,
>
> I'm trying to use m2eclipse on a project that uses the
> apt-maven-plugin [1] and it's having difficulty locating the apt
> compiler.
>
> It appears to be a classloader problem in AptUtils.getAptClass [2]
> which attempts to locate the tools.jar class com.sun.tools.apt.Main in
> the mojo's classloader.  This works fine on the command line when
> Maven is run using a JDK (as opposed to a JRE), but fails in m2eclipse
> even when Eclipse is run with a JDK.  I'm not surprised given the
> complex Eclipse/OSGi classloader hierarchy, but was wondering if
> anyone can share their Eclipse knowledge on how to obtain a suitable
> classloader that could access tools.jar, if possible?  The alternative
> I guess is to fork the execution.
>
> Cheers,
>
> Mark
>
> [1] http://mojo.codehaus.org/apt-maven-plugin/
> [2] 
> http://svn.codehaus.org/mojo/trunk/mojo/apt-maven-plugin/src/main/java/org/codehaus/mojo/apt/AptUtils.java
>

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

    http://xircles.codehaus.org/manage_email


Reply via email to