Groovyc ant task does not work with fork = "true"

When I run groovyc without the fork option, it works fine. But with fork = "true", it crashes with an error message:

Error: Could not find or load main class org.codehaus.groovy.ant.FileSystemCompilerFacade 

What is wrong here?

Ant task:

 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="test.path" /> <groovyc fork="true" srcdir="../myproject/src-test" destdir="${build.test.dir}"> <javac debug="true" source="1.7" target="1.7" > <compilerarg value="-XX:-UseSplitVerifier"/> </javac> </groovyc> 

EDIT: test.path contains groovy jar: (...):/home/pkalinow/(..)/groovy-all-1.8.6.jar:(...)

+6
source share
1 answer

The class pathref = "test.path" must be specified in both <taskdef> and <groovyc> invocations when groovyc is forked.

I cannot find confirmation in the documentation, but it seems that only non-forking groovyc inherits the classpath from taskdef.

+3
source

Source: https://habr.com/ru/post/976768/


All Articles