JavaxToolsCompiler

Stuart McCulloch mcculls at gmail.com
Mon Sep 14 19:21:11 UTC 2015


Yes, the issue is that ToolProvider.getSystemJavaCompiler() is returning null when using the Jigsaw EA with Maven.

AFAICT this is because it’s now using the service loader mechanism which is influenced by the Thread’s context ClassLoader  

The following patch to make sure Maven uses the system context when looking up the compiler appears to solve the issue:

https://github.com/codehaus-plexus/plexus-compiler/pull/13

--  
Cheers, Stuart


On Monday, 14 September 2015 at 19:27, Alan Bateman wrote:

> On 14/09/2015 17:40, Robert Scholte wrote:
> > Hi,
> >  
> > On behalf of the Apache Maven team I'd like to ask for advice for  
> > changing the JavaxToolsCompiler[1]
> > This implementation is used when java code is being compiled with  
> > Maven *by default*, so right now when pointing JAVA_HOME to the latest  
> > JDK9 version builds will fail.
> > There are other ways to compile, e.g. use the fork-parameter[2] or  
> > with toolchains[3], but what I'd like to know is whether it is still  
> > possible/valid to use javax.tools.JavaCompiler and is so: how should  
> > we rewrite this code?
> >  
>  
>  
> Thanks for bringing this up as a few people have reported issues with  
> Maven not finding the compiler.
>  
> Just to be clear, are you seeing this issue with the regular JDK 9 EA  
> builds or just the Jigsaw EA builds? Did this start when tools.jar went  
> away? I just did a quick test to check that  
> ToolProvider.getSystemJavaCompiler() is returning the system  
> JavaCompiler is returned for both builds (and it is). Is the issue that  
> you are seeing that getSystemJavaCompiler() is returning null?
>  
> -Alan.
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe at maven.apache.org (mailto:dev-unsubscribe at maven.apache.org)
> For additional commands, e-mail: dev-help at maven.apache.org (mailto:dev-help at maven.apache.org)
>  
>  




More information about the jigsaw-dev mailing list