On 15/08/2010, at 8:53 PM, Andrew Eisenberg wrote:

> Hi all,
> 
> I am trying to execute an ant javac call inside of a gradle task.
> However, I am trying to execute with a custom CompilerAdapter, using
> the compiler attribute (this allows me to run the javac task with my
> own compiler implementation).  In order to do this, I need to add an
> extra jar to ant's classpath.  Here is the current build.gradle that I
> have, but it is not working:
> 
> 
> dependencies {
>  files('/Users/andrew/libs/my-compiler-adapter.jar')
> }
> 
> task compile << {
>   ant.javac(srcdir: '.', verbose: true, compiler:
> 'org.foo.bar.MyCompilerAdapter') {
>        include(name: '**/*.java')
>        include(name: '**/*.groovy')
>    }
> }

You'll need to tell the javac task the classpath where it can find the 
implementation. For example:

ant.javac(...) {
    compilerClasspath(location: '/Users/andrew/libs/my-compiler-adapter.jar')
    ...
}
        

> 
> The script is failing with the message:
> 
> Execution failed for task ':compile'.
> Cause: Class not found: org.foo.bar.MyCompilerAdapter
> 
> It looks like the file in the dependencies section is not being added
> to the ant classpath.  (As a side note, this is working when I run the
> related script directly in ant.)  Any ideas on how to fix this script?
> 
> Much appreciated.
> 
> --andrew
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to