When emerging ant 1.5.3-r5, it fails because the ebuild sets JAVA_HOME to JDK_HOME, which
is undefined in my case. I made changes to the ebuild to set JAVA_HOME to the location of
the installed Java Development Kit but it still failed.
I found out the reason why the ebuild failed was because my system's Java environment was
set to "blackdown-jre-1.4.1". I pulled out the changes to the ebuild and added others to check
the Java environment. After changing the Java environment to "blackdown-jdk-1.4.1" using
"java-config --set-system-vm=blackdown-jdk-1.4.1", ant installed with the modified ebuild.
Steps to Reproduce:
1. Set your Java Environment to blackdown-jre-1.4.1
2. emerge ant
>>> Unpacking source...
>>> Unpacking apache-ant-1.5.3-1-src.tar.bz2 to /var/tmp/portage/ant-1.5.3-r5/work
* Applying build.sh-exit-fix.patch.gz... [ ok ]
* Applying 1_6_backport-jdk142.patch.gz... [ ok ]
>>> Source unpacked.
Warning: JAVA_HOME environment variable not set.
If build fails because sun.* classes could not be found
you will need to set the JAVA_HOME environment variable
to the installation directory of java.
Error: JAVA_HOME is not defined correctly.
We cannot execute java
!!! ERROR: dev-java/ant-1.5.3-r5 failed.
!!! Function src_compile, Line 79, Exitcode 1
!!! (no error message)
IMHO, the ant ebuild should of recognized the Java JDK was installed regardless of which Java
enviroment was seleted.
Created attachment 19022 [details, diff]
Not very ideal patch for the ebuild
This patch is not ideal because an admin cannot start an emerge (i.e. xalan)
upgrade that depends on ant and walk away while it runs.
The patch adds a check to pkg_setup() to verify which Java environment is
selected and fail if the correct one is not selected.
The setting of JAVA_HOME to JDK_HOME was removed because it is redundant.
Also, 'java-config --list-available-packages' is now borked after the install.
'java-config --list-available-packages' produces the following output:
[ant] Java-based build tool similar to 'make' that uses XML configuration
[fop] "" (/usr/share/fop/package.env)
[saxon] The SAXON package is a collection of tools for processing XML documents:
XSLT processor, XSL library, parser. (/usr/share/saxon/package.env)
Disregard that last comment about "java-config --list-available-packages".
I was thinking "java-config --list-available-vms" but using "java-config
--list-available-packages" instead. My bad.
It is caused by blackdown-jdk not adding its environment vars to /etc/env.d
but to /etc/env.d/java.
env-update doesn't process subdirs it seems.
Just copy the file to proceed.
After setting the VM with java-config did you made env-update && source /et/profile ???
Moving this again to firstname.lastname@example.org, so everyone out there can help.
I think that if you emerge ant, it will need a vm an it will install the default one. If a user changes the default system VM ant its not responsible of checking it cause it was installed correctly, but the user broke the configuration.
If this error is checked here, it will need to be checked on every java ebuild, so its not an option.
Well the thing of it is I didn't change the default VM before I had problems with ant.
I think the first time blackdown-jre-1.4.1 was required by an ebuild was when I installed OpenOffice-bin. Another package I installed later on depended on blackdown-jdk-1.4.1 but the Java VM was not changed by the ebuild. I can't remember which package it was.