Troubleshooting Groovyc compilation issues on SAP Commerce Cloud
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’:
<extname>.groovyc.fork=false
Example from documentation:
2bocctests.groovyc.fork=false
b2bpunchoutocctests.groovyc.fork=false
configurablebundleocctests.groovyc.fork=false
customerticketingocctests.groovyc.fork=false
textfieldconfiguratortemplateocctests.groovyc.fork=false
odata2webservices.groovyc.fork=false
integrationbackoffice.groovyc.fork=false
integrationbackofficetest.groovyc.fork=false
webhookbackoffice.groovyc.fork=false
odata2webservicesfeaturetests.groovyc.fork=false
sapproductconfigfacades.groovyc.fork=false
sapproductconfigocctests.groovyc.fork=false
Or for all extensions(not recommended):
groovyc.fork=false
I hope you won’t encounter this issue, but if you do, this guide can help you resolve it quickly.
Read more: