I'm maintaining an old Java project that was originally written in 1.4 and is now being migrated to a Java 7 environment. The project uses Ant.
When building I receive the following warning
warning: [options] bootstrap class path not set in conjunction with -source 1.4
and I think I've now done enough reading to understand that this is because I'm using the Java 7 compiler to compile code to run in 1.4. However I don't want this - I want to use the 7 compiler to build 7 code.
Using ant -v
I see that the argument -source 1.4
is passed to the javac command but I can't find where it's coming from. None of the build.properties files used by build.xml provide this argument. The project uses some xmlbean functionality and the warning is issued when building the xmlbean target in build.xml.
I have some other projects that are going through a similar process and these do not issue the warning during the build. In these projects Ant does not pass -source 1.4. to javac They are not using xmlbeans so I thought maybe the issue could be related to this.
After a lot of searching I decided I would just put the 1.4 rt.jar on the classpath and forget about it. However this didn't help. I first included it in the xmlbeans target's classpath and then as the 'bootclashpath' property for the whole build.xml file, but no joy.
The relevant section of build.xml looks like this
<target name="xmlbeans" depends="setup">
<xmlbean classgendir="${schema.compile.dir}" destfile="${dist.dir}/${schema.jar.file}" failonerror="true">
<fileset dir="${config.dir}">
<include name="**/*.xsd"/>
</fileset>
<classpath>
<pathelement location="${lib.dir}/xbean.jar"/>
<pathelement location="${lib.dir}/jsr173_1.0_api.jar"/>
</classpath>
</xmlbean>
</target>
<taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean">
<classpath>
<pathelement location="${lib.dir}/xbean.jar"/>
<pathelement location="${lib.dir}/jsr173_1.0_api.jar"/>
</classpath>
</taskdef>