Thanks for the links to the documentation, I have been trying to get the
antlr-ant task to execute through gradle. I have the following build
configuration script so far:

apply plugin: 'java'

repositories {
    mavenCentral()
}

configurations {
    antAntlrConf
}

dependencies {
    antAntlrConf 'ant:ant-antlr:1.6.+'
    compile group: 'org.antlr', name: 'antlr-runtime', version: '3.+'
    testCompile group: 'junit', name: 'junit', version: '4.+'
}

task generateGrammarSources (description: 'Invokes the antlr3-task from ant
to generate grammar sources') << {
    generatedDir = new File(project.buildDir.toString() + '/generated-src/')
    generatedDir.mkdirs()

    ant {
        taskdef(name: 'antlr', 
                classname: 'org.apache.tools.ant.taskdefs.optional.ANTLR', 
                classpath: configurations.antAntlrConf.asPath)
            
        antlr(target: 'src/main/antlr3/Calculator.g', outputdirectory:
'build/generated-src/')
    }
}

compileJava.dependsOn generateGrammarSources

This does not work yet, the build fails with the following error:

gradle clean generateGrammarSources
:clean
:generateGrammarSources
Trying to override old definition of datatype antlr

FAILURE: Build failed with an exception.

I don't understand what it means by "Trying to override old definition of
datatype antlr" I have been working on it for a while and was hoping I could
get a few points in the right direction.


Adam Murdoch-2 wrote:
> 
> 
> 
> On 8/04/10 11:30 AM, chrismolozian wrote:
>> Thanks very much for the fast response. I'm not well versed in either Ant
>> or
>> Gradle yet to begin connecting the two together, is there some
>> documentation
>> you could point me to that might help.
>>    
> 
> Here's the chapter about using Ant with Gradle: 
> http://gradle.org/0.9-preview-1/docs/userguide/ant.html
> 
> Section 17.1.1 has some information about using external tasks in 
> Gradle. There's also some more examples in the Cookbook at: 
> http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-3rdpartytools
> 
> 
> -- 
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/using-antlr-in-gradle-tp28171481p28191052.html
Sent from the gradle-user mailing list archive at Nabble.com.

Reply via email to