The source and target attributes of <javac> don't have any default values for historical reasons. Since the underlying javac compiler's default depends on the JDK you use, you may encounter build files that don't explicitly set those attributes and that will no longer compile using a newer JDK. If you cannot change the build file, Ant provides two properties that help you setting default values for these attributes. If the attributes have been set explicitly, the properties listed here will be ignored.

ant.build.javac.source

Since Ant 1.7

Provides a default value for <javac>'s and <javadoc>'s source attribute.

ant.build.javac.target

Since Ant 1.7

Provides a default value for <javac>'s target attribute.