Thanks Adam, that worked great. I use the Eclipse compiler when building on Hudson; there is a plugin [1] that can parse the Eclipse compiler warnings output. Having those warnings appear in the Hudson dashboard is much more relevant to developers, because they are the same warnings that they should be seeing in their IDE. This is only an option because the Hudson build output doesn't go to production -- I wouldn't want to use the Eclipse compiler for that.
I have added the usage you described to the cookbook -- http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-usingEclipseJDTCoreBatchCompiler%28ECJ%29 -David [1] http://wiki.hudson-ci.org//display/HUDSON/Warnings+Plugin On Fri, Oct 15, 2010 at 5:33 AM, Adam Murdoch <[email protected]> wrote: > > On 11/10/2010, at 8:02 PM, David Resnick wrote: > > Hi, > > I'm new to using Gradle, and have a question about configuring the > compileJava task. > > I've set the compiler to use with > compileJava.options.define(compiler: > "org.eclipse.jdt.core.JDTCompilerAdapter") > > but I need to include the ecj.jar in the compiler classpath. > > I created a special configuration but I can't seem to make it > available for finding the compiler in the compileJava task. > > configurations { jdt {} } > dependencies { > jdt "org.eclipse.jdt:ecj:3.5" > } > compileJava.options.define(bootClasspath: configurations.jdt.files) > > It looks like the ant javac property I need to set is > compilerClasspath, which doesn't seem to be settable in the > CompileJava Groovy class (it isn't listed in the Groovy > documentation). > > Is there anyway to do this apart from putting the ecj jar file inside > my gradle dist lib folder? > > Sort of. You can do the same sort of thing by instead injecting the jars > into the Ant classloader from the build script. Here's an example: > configurations { > jdt > } > dependencies { > jdt "org.eclipse.jdt:ecj:3.5" > } > compileJava { > options.compiler = "org.eclipse.jdt.core.JDTCompilerAdapter" > doFirst { > ClassLoader antClassLoader = > org.apache.tools.ant.Project.class.classLoader > configurations.jdt.each { File f -> > antClassLoader.addURL(f.toURI().toURL()) > } > } > } > > I'm curious why you want to use the eclipse compiler, if you don't mind me > asking? > > -- > Adam Murdoch > Gradle Developer > http://www.gradle.org > CTO, Gradle Inc. - Gradle Training, Support, Consulting > http://www.gradle.biz > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
