ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: issues with ant
Date Wed, 10 Nov 2010 05:17:39 GMT
On 2010-11-09, Ludmila Shikhvarg wrote:

> I've discovered some ant's problem during gump testing with jdk7

Thank you for reporting them.  It might be a good idea to open bugzilla
issues for them.

> 1. The projects below failed to compile with jdk7 (1.7.0):
> junit, test-junit

...

> [javac] javac: target release 1.5 conflicts with default source release 1.7

> Thought, there are should not be jdk dependency

This is not really Ant's fault.  The projects use a javac task like

     <javac target="1.5">...</javac>

which is translated to a command line 

      javac -target 1.5 ...

This works fine with JDK6's javac but causes the error you've cited when
run with OpenJDK 7.  This is not the first time this happens, the javac
developers obviously don't care a bit for backwards compatibility.

Ant's DefaultCompilerAdapter contains this code

        } else if ((assumeJava15() || assumeJava16())
                   && attributes.getTarget() != null) {
            String t = attributes.getTarget();
            if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3")
                || t.equals("1.4")) {
                String s = t;
                if (t.equals("1.1")) {
                    // 1.5.0 doesn't support -source 1.1
                    s = "1.2";
                }
                attributes.log("", Project.MSG_WARN);
                attributes.log("          WARNING", Project.MSG_WARN);
                attributes.log("", Project.MSG_WARN);
                attributes.log("The -source switch defaults to 1.5 in JDK 1.5 and 1.6.",
                               Project.MSG_WARN);
                attributes.log("If you specify -target " + t
                               + " you now must also specify -source " + s
                               + ".", Project.MSG_WARN);
                attributes.log("Ant will implicitly add -source " + s
                               + " for you.  Please change your build file.",
                               Project.MSG_WARN);
                cmd.createArgument().setValue("-source");
                cmd.createArgument().setValue(s);
            }

which implicitly adds a -source 1.2 when running on Java5 or Java6 and
the user specified the target attribute but not the source attribute.
We'd need similar code to adapt to the new default in OpenJDK7 and a
target different from 1.7.

Again, this really is javac's fault and Ant can only try to lessen the
impact.

> 2. Failed to run projects due to:
> svn: URL 'http://svn.apache.org/repos/asf/ant/antlibs/ant-vss/trunk' doesn't exist

Looks as if the svn:externals on
http://svn.apache.org/repos/asf/ant/antlibs/all-trunks is wrong, I'll
look into it.  Thank you for reporting.

> 3. All projects related to bootstrap-ant started to fail from jdk7
> b112 with exception below:

> compile-tests:
> Created dir: /export/home/dtftest/gump/results/ant/build/testcases
> Compiling 287 source files to /export/home/dtftest/gump/results/ant/build/testcases
> /export/home/dtftest/gump/results/ant/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java:209:
NullDriver is not abstract and does not override abstract method getParentLogger() in Driver
>    public static class NullDriver implements Driver {

Ahh, JDBC is changing in backwards incompatible ways again.  Even if we
fix Ant's tests you will find lots of breaking projects downstream
later.

I haven't checked the new definition of Driver, let's hope it is
possible to implement it in a way that also compiles on JDK 1.4 (which
is the minimum version of Java supprted by Ant).

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message