Wsdl2java failing with "The Command line is too long." error on Windows 10

Hi, I am trying to build a Gradle project (Spring Boot) on Windows 10 and ended up failed with “The Command line is too long.” error. Please assist.

build.gradle looks like below

def webservices =[
[wsdl: ‘AWDService.wsdl’],
[wsdl: ‘ImageService.wsdl’],

webservices.each { webservice ->
task “wsdl2java${webservice.wsdl}”(type: Exec) {
commandLine getCommandListForOS("${wfpHome}/bin/WSDL2Java") +
packageNames +
[’-role’, ‘server’,
’-container’, ‘web’,
’-classpath’, configurations.runtime.asPath,
’-output’, “${buildDir}/generated-src/wsdl2java/”,

doLast {
  FileTree tree = fileTree(dir: "${buildDir}/generated-src/wsdl2java/")
  tree.include "**/*"
  tree.include "**/*"


compileJava.dependsOn “wsdl2java${webservice.wsdl}”


Error as below:

The command line is too long.
:Retail-Services-WEB:wsdl2javaAWDService.wsdl FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:Retail-Services-WEB:wsdl2javaAWDService.wsdl’.

Process ‘command ‘cmd’’ finished with non-zero exit value 1

  • Try:
    Run with --info or --debug option to get more log output.

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:Retail-Services-WEB:wsdl2javaAWDService.wsdl’.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(

It works by this.

configurations.runtime.files*.name.join(" ")