https://bz.apache.org/bugzilla/show_bug.cgi?id=65539
Bug ID: 65539 Summary: javac task parses command line arguments incorrectly Product: Ant Version: 1.10.11 Hardware: PC OS: All Status: NEW Severity: regression Priority: P2 Component: Core tasks Assignee: notifications@ant.apache.org Reporter: seancle...@ie.ibm.com Target Milestone: --- We are moving from Apache Ant 1.10.6 to Apache 1.10.11 and we have noticed a change in behaviour with the javac task on Linux and Windows builds which, specifically on Windows causes a 'CreateProcess error=206, The filename or extension is too long' error to occur. This appears to have been introduced in Apache Ant 1.10.7 but we can still see it in 1.10.11. Has there been changes made around the javac task between Ant 1.10.6 and 1.10.7 that might account for the changes below Our javac task looks like this: <javac memoryMaximumSize="2048m" memoryInitialSize="2048m" fork="yes" srcdir="C:\projectLocation\build\src" destdir="C:\projectLocation\build\classes" debug="on" includeantruntime="false" deprecation="true" debuglevel="lines,vars,source" classpathref="compile.cp"> <compilerarg value="-Xbootclasspath/p:${toString:xml.cp}" /> <compilerarg value="-Xmaxwarns"/> <compilerarg value="${cmp.maxwarnings}"/> <compilerarg line="${cmp.compilerarg}"/> </javac> When we run the task with Ant 1.10.6 the compilation arguments on a verbose output looks like this: [javac] Compilation arguments: [javac] '-J-Xms2048m' [javac] '-J-Xmx2048m' [javac] '-deprecation' [javac] '-d' [javac] 'C:\projectLocation\build\classes\' [javac] '-classpath' [javac] '<<compile.cp>>' //This expands on the output to include the full list of Jars in the compile.cp classpathref [javac] '-sourcepath' [javac] 'C:\projectLocation\build\src' [javac] '-g:lines,vars,source' [javac] '-Xbootclasspath/p:${toString:xml.cp}' //This expands on the output to include the full list of Jars in the xml.cp classpathref [javac] '-Xmaxwarns' [javac] '${cmp.maxwarnings}' When we run on the same environment and change the Ant version between 1.10.7 and 1.10.11 the compilation arguments change to: [javac] Compilation arguments: [javac] '-J-ms2048m' \\Change 1 [javac] '-J-mx2048m' \\Change 2 [javac] '-deprecation' [javac] '-d' [javac] 'C:\projectLocation\build\classes\' [javac] '-classpath' [javac] '<<compile.cp>> + C:\projectLocation\build\src' \\Change #3 [javac] '-g' \\ Change #4 [javac] '-Xbootclasspath/p:${toString:xml.cp}' [javac] '-Xmaxwarns' [javac] '${cmp.maxwarnings}' Changes seen in verbose output: 1. memoryMaximumSize is being passed to the command line as -J-ms2048m instead of -J-Xms2048m 2. memoryInitialSize is being passed to the command line as -J-ms2048m instead of -J-Xms2048m 3. debuglevel is set to blank instead of lines,vars,source 4. The classpath is appended with the source directory which is new behaviour from Ant 1.10.7+ 5. sourcepath is not being set in the compilation arguments from Ant 1.10.7+ Actual results: On Windows, we are getting the 'Create Process error=206' returned and the javac task fails with no Java files compiled in to the destination directory ============ [transform] Clearing cached class loaders.... [transform] Cached class loaders cleared. An error has occurred executing the build. BUILD FAILED C:\IBM\Curam\Development\CuramCDEJ\bin\build.xml:1152: Error running C:\IBM\WebSphere\AppServer\java\8.0\bin\javac.exe compiler at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:594) at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:74) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1388) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1117) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299) at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:508) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99) at org.apache.tools.ant.Task.perform(Task.java:350) at org.apache.tools.ant.Target.execute(Target.java:449) at org.apache.tools.ant.Target.performTasks(Target.java:470) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401) at org.apache.tools.ant.Project.executeTarget(Project.java:1374) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1264) at org.apache.tools.ant.Main.runBuild(Main.java:818) at org.apache.tools.ant.Main.startAnt(Main.java:223) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101) Caused by: java.io.IOException: Cannot run program "C:\IBM\WebSphere\AppServer\java\8.0\bin\javac.exe" (in directory "C:\IBM\Curam\Development\webclient"): CreateProcess error=206, The filename or extension is too long at java.lang.ProcessBuilder.start(ProcessBuilder.java:1059) at java.lang.Runtime.exec(Runtime.java:631) at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58) at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:424) at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:438) at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:591) ... 19 more Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:455) at java.lang.ProcessImpl.start(ProcessImpl.java:151) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1040) ... 24 more Total time: 2 minutes 5 seconds ============ On Linux, the Java files are actually compiled in to the destination directory and the javac task completes without issue but the same changed compile arguments are being returned when verbose output is turned on when using Ant 1.10.7+. -- You are receiving this mail because: You are the assignee for the bug.