Hi, 
You need to add the dependencies manually to the ant tasks classpath.
Short sample that should work:
// custom dependency configurationconfigurations {   antcompile }
dependencies {  antcompile files('/Users/andrew/libs/my-compiler-adapter.jar')}
task compile << { ant.javac(srcdir: '.', verbose: true, 
compiler:'org.foo.bar.MyCompilerAdapter', 
classpath:configurations.antcompile.asPath()) { include(name: '**/*.java') 
include(name: '**/*.groovy') } }

cheersMagnus


> Date: Sun, 15 Aug 2010 20:53:14 -0700
> From: [email protected]
> To: [email protected]
> Subject: [gradle-user] how to add a jar file to gradle's AntBuilder
> 
> 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')
>     }
> }
> 
> 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
> 
> 
                                          

Reply via email to