CreateProcess error=206, The filename or extension is too long

Hi my company upgraded our grails project from 2.5 to 4 and we also completely switched to docker for the build process.

Since the switch i always got the “CreateProcess error=206, The filename or extension is too long” when running the app. Using the plugin “com.virgo47.ClasspathJar” fixed this issue and i was able to at least startup the project.

Im now running into the same issue when it comes to creating the docker image and i dont know how to fix this issue:

This is the task and the error gets thrown inside of dependsOn: assemble

task prepareDocker(type: Copy, dependsOn: assemble) {
description = ‘Copy files from src/main/docker and application jar to Docker temporal build directory’
group = ‘Docker’

from 'src/main/docker'
from project.jar

into dockerBuildDir


Both of my teammates use macs, but since im on windows this has become an issue.

Any ideas what to do? All online help is about gradle itself and not about docker.