On 10/04/10 10:17 PM, chrismolozian wrote:
After further research and testing I discovered that the antlr-ant task
referenced by my build configuration only supported antlr version 2. It
seems that the antlr3-ant task is not on any repository that I can find, to
solve this problem I have created a 'build-deps' folder in my project and am
loading the local task jar to process the grammar files. My build script
looks like the following (note: I am using the latest version of gradle from
trunk, version 0.9+):
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.antlr', name: 'antlr-runtime', version: '3.+'
compile group: 'commons-cli', name: 'commons-cli', version: '1.+'
testCompile group: 'org.antlr', name: 'gunit', 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: 'antlr3', classname:
'org.apache.tools.ant.antlr.ANTLR3'){
classpath {
fileset(dir: 'build-deps', includes: 'antlr3-ant.jar')
}
}
antlr3(target: 'src/main/antlr3/Calculator.g',
outputdirectory: 'build/generated-src/')
}
}
compileJava.dependsOn generateGrammarSources
This still does not work. I need to add the ANTLR tool to the classpath of
Ant so that it can compile the grammar files. The build error output is
here:
[ant:antlr3] Exception in thread "main" java.lang.NoClassDefFoundError:
org/antlr/Tool
Could you run gradle with the -s command-line option, so we can see the
stack trace for the failure?
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email