I have my Existing JAVA project.
I have to run a Groovy script through a Java file from this project.
I'm Using Groovy Grails Tool Suite (GGTS).
Source Code has following imports:
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyObject;
import groovy.lang.MetaMethod;
Now I am trying to build it using build.xml (ANT) configuration.
BUILD.xml
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
<classpath refid="groovy.classpath" />
</taskdef>
<target name="compile.groovy" description="Compile both groovy&Java"depends="init">
<groovyc srcdir="src" destdir="bin/classes">
<classpath refid="groovy.classpath" />
<javac debug="on" deprecation="true" />
</groovyc>
</target>
But I get the following error :
package groovy.lang does not exist [javac] import groovy.lang.*;
Please assist as to why the groovy-all-2.0.7.jar is not recognised!!
Have you tried removing groovy-all
from your ant/lib
directory, adding it to a lib
directory under your project, and then doing:
<path id="groovy.all.classpath">
<fileset dir="${basedir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="groovy.all.classpath"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.