Bug 62705

Summary: tomcat 8.5.33+ requires jdk 9
Product: Tomcat 8 Reporter: Brett Sutton <bsutton>
Component: PackagingAssignee: Tomcat Developers Mailing List <dev>
Status: CLOSED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 8.5.33   
Target Milestone: ----   
Hardware: PC   
OS: Linux   

Description Brett Sutton 2018-09-12 04:07:01 UTC
My build from tomcat trunk stopped working a little while ago with the error:

build/build.xml:675: javac doesn't support the "release" attribute

Originally I though the problem was that I need the latest version of ant so I upgraded to ant  1.10.5 .

The problem however persisted.

This leads me to the conclusion that the problem is that the ant scripts now actually require a minimum of jdk 9 as they are passing the -release flag to javac.

It was my understanding that tomcat 8 could be built with java 7 onwards.
Comment 1 Igal Sapir 2018-09-12 05:05:21 UTC
I actually just got that same error a couple of hours ago building 9.0.13-dev using Java 1.8.0_172 and Ant 1.9.7 on Windows.

I upgraded to ant 1.10.5 and it solved the issue for me.

Are you sure that the correct version of Ant is on the path?  Can you confirm by running the command:

  ant -version

?
Comment 2 Igal Sapir 2018-09-12 06:25:37 UTC
I just built again with Java 1.8.0_181 and Ant 1.10.5 on Fedora 28 with no issue.

Ant output shows that the --release switch is ignored on a sub-9 Java version:

    [javac] Support for javac --release has been added in Java9 ignoring it
Comment 3 Konstantin Kolinko 2018-09-12 06:40:16 UTC
> build/build.xml:675: javac doesn't support the "release" attribute

The above message means that the "javac" task of Ant does not know the "release" attribute, cannot process the build file. Support for "release" attribute was added in Ant 1.9.8 and 1.10.0.

The required minimum version of Ant is documented in BUILDING.txt file of Tomcat.


The official release of Tomcat 8.5.34 was built with Ant 1.9.9 and JDK 7u80,
as can be seen in MANIFEST.MF files in jars.

The release of Tomcat 9.0.12 was built with Ant 1.9.9 and JDK 8u181.
Comment 4 Brett Sutton 2018-09-13 01:49:52 UTC
apologies, looks like ti was a path issue.

I've re-ran the code and yes it does compile with ant 1.10.5 and jdk 8.

So closing this one out.
Comment 5 Brett Sutton 2018-09-13 03:53:54 UTC
Just for others.

The problem was that I had hand installed ant into my user account but when the build tools ran they ran as sudo which didn't have the ant environment vars pointing at the wrong version.
Comment 6 Emmanuel Bourg 2018-09-13 06:36:42 UTC
We should probably check the version of Ant used and stop the build with an explicit error message.
Comment 7 Igal Sapir 2018-09-13 06:43:09 UTC
(In reply to Emmanuel Bourg from comment #6)
> We should probably check the version of Ant used and stop the build with an
> explicit error message.

I can add that.
Comment 8 Igal Sapir 2018-09-13 07:08:48 UTC
Descriptive error added in commit r1840783 if running Ant version is older than the minimum required 1.9.8
Comment 9 Igal Sapir 2018-09-13 07:26:25 UTC
(In reply to Igal Sapir from comment #8)
> Descriptive error added in commit r1840783 if running Ant version is older
> than the minimum required 1.9.8

Simplified check in commit r1840784
Comment 10 Christopher Schultz 2018-09-16 19:57:32 UTC
(In reply to Brett Sutton from comment #5)
> [W]hen [my] build tools ran they ran as sudo

Do you mean root? Or just sudo-to-other-user?

You should never have to build Tomcat as root. Since I'm mentioning it, you should never run Tomcat as root, either.