New jre layout broke Maven and Ant

Stephen Bannasch stephen.bannasch at deanbrook.org
Sat Oct 1 13:37:12 PDT 2011


At 2:16 PM +0200 9/30/11, Henri Gomez wrote:
>Hi guys
>
>I got various reports on openjdk-osx-build about failure to detect tools.jar :
>
>http://code.google.com/p/openjdk-osx-build/issues/detail?id=22
>http://code.google.com/p/openjdk-osx-build/issues/detail?id=23

This also broke building OpenJDK8 (mlvm)

The build system for OpenJDK 8 requires a working Java 1.7.

The build fails with this error (confusing because I have ant v1.8.2 installed):

  ANT_VER = 1.7.0. [requires at least 1.7.1]

When ant -version is called from the build scripts this is the output:

Unable to locate tools.jar. Expected to find it in /Users/stephen/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/1.7.0.jre/Contents/Home/lib/tools.jar Apache Ant(TM) version 1.8.2 compiled on June 3 2011

And unfortunately the code that looks for a version string finds the Java version '1.7.0' first:

  jdk/make/shared/common/Defs.gmk:135

  # Given a line of text, get the version number from it
  define GetVersion
  $(shell echo $1 | sed -e 's@[^0-9]*\([0-9][0-9]*\.[0-9][.0-9]*\).*@\1@' )
  endef


>As a temporary fix, I'll add a symlink in package
>
>ln -s lib/tools.jar 1.7.0.jre/Contents/Home/lib/tools.jar
>
>tools.jar is under JAVA_HOME/lib for both OS/X and Linux version.
>
>Could it be something related to JRE_HOME/JAVA_HOME ?

Adding Henri's fix to my macosx-port build scripts fixes the problem: https://gist.github.com/908156

echo '
*** fix missing tools.jar in jre
*** see: http://mail.openjdk.java.net/pipermail/macosx-port-dev/2011-September/001045.html
'
ln -s ../../../../lib/tools.jar build/macosx-universal/j2sdk-bundle/1.7.0.jdk/Contents/Home/1.7.0.jre/Contents/Home/lib/tools.jar

*** while the problem is annoying, and figuring out why my mlvm build was failing took way more time than I would have liked, the fact that this is open source and the problem is discussed openly on this list and I can fix it myself is a huge plus ***


More information about the macosx-port-dev mailing list