With Ant 1.8.2, Javac task failes when the "target" attribute is specified as 1.1 and source attribute is not specified. Exsample of build.xml. ------------------------------------------------------------------------ <?xml version="1.0"?> <project default="compile"> <target name="compile"> <javac destdir = "classes" srcdir = "src" target = "1.1"/> </target> </project> ------------------------------------------------------------------------ Running the build.xml. (Version of javac is 1.6.0_22.) ------------------------------------------------------------------------ % ant Buildfile: build.xml compile: [javac] build.xml:6: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 1 source file to classes [javac] [javac] WARNING [javac] [javac] The -source switch defaults to 1.5 in JDK 1.5 and 1.6. [javac] If you specify -target 1.2 you now must also specify -source 1.1. [javac] Ant will implicitly add -source 1.1 for you. Please change your build file. [javac] javac: invalid source release: 1.1 [javac] Usage: javac <options> <source files> [javac] use -help for a list of possible options BUILD FAILED build.xml:6: Compile failed; see the compiler error output for details. ------------------------------------------------------------------------ Please note that the target attribute value is shown as 1.2. I investigated the problem: in org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter, setImplicitSourceSwitch method is in called as following. setImplicitSourceSwitch( (assumeJava15() || assumeJava16()) ? "1.5 in JDK 1.5 and 1.6" : "1.7 in JDK 1.7", cmd, s, t); But, setImplicitSourceSwitch method is declared as following. private void setImplicitSourceSwitch( String defaultDetails, Commandline cmd, String target, String source) Please note the orders of "target" and "source": the call above passes parameters in wrong order.
mea culpa. Fixed with svn revision 1058854 The real solution for you is to avoid any implicit manipulations by Ant and specify source explicitly as well (likely as 1.3).