Recently, while setting up our new project on my local machine, I encountered a compilation error for Groovyc with the message: “Error running forked groovyc”.
After investigating, I found out that starting from version 2205, SAP makes Groovyc ant task compile all builds in a forked mode for all extensions in all operating systems.
What Groovyc is and fork mode means?
Groovyc ant is a task that allows us to compile Groovy source code using the ant build tool. The Groovyc ant task provides a convenient way to integrate Groovy compilation into our Ant build scripts. We have a lot of OOTB tests written in Groovy from SAP and that’s why they use the task in the building process.
When fork mode is activated, this means Groovyc is using a spawned instance of the JVM.
Back to the issue
It turned out that when installing SAP Commerce on Windows in long installation directories, it is possible to encounter issues with forked Groovyc.
To resolve this issue, we can disable fork mode for the extensions that are causing the problem. This can be done by modifying the local.properties for the affected extensions and setting the ‘fork’ property to ‘false’:
Example from documentation:
Or for all extensions(not recommended):
I hope you won’t encounter this issue, but if you do, this guide can help you resolve it quickly.