Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 675992 - dev-java/ant-core-1.9.13 : Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
Summary: dev-java/ant-core-1.9.13 : Error: Could not find or load main class org.apach...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-21 19:05 UTC by Toralf Förster
Modified: 2019-01-24 22:06 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,15.54 KB, text/plain)
2019-01-21 19:05 UTC, Toralf Förster
Details
dev-java:ant-core-1.9.13:20190121-160051.log (dev-java:ant-core-1.9.13:20190121-160051.log,4.64 KB, text/plain)
2019-01-21 19:05 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,39.10 KB, text/plain)
2019-01-21 19:05 UTC, Toralf Förster
Details
environment (environment,157.23 KB, text/plain)
2019-01-21 19:05 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,10.70 KB, application/x-bzip)
2019-01-21 19:05 UTC, Toralf Förster
Details
temp.tbz2 (temp.tbz2,34.33 KB, application/x-bzip)
2019-01-21 19:05 UTC, Toralf Förster
Details
build.log using JAVA_PKG_DEBUG=yes (build.log,22.69 KB, text/plain)
2019-01-24 13:42 UTC, Robert Förster
Details
patch to fix bootstrap (ant_home.patch,352 bytes, patch)
2019-01-24 21:33 UTC, Miroslav Šulc
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2019-01-21 19:05:27 UTC
... Cleaning Up Build Directories
... Done Bootstrapping Ant Distribution
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
 * ERROR: dev-java/ant-core-1.9.13::gentoo failed (compile phase):
 *   build failed
 * 

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.0-desktop-gnome-systemd_abi32+64_20190120-102705

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-8.2.0 *

Available Python interpreters, in order of preference:
  [1]   python3.6
  [2]   python2.7 (fallback)

Available Rust versions:
  [1]   rust-1.32.0 *
java-config:
The following VMs are available for generation-2:
*)	IcedTea JDK 3.10.0 [icedtea-bin-8]
Available Java Virtual Machines:
  [1]   icedtea-bin-8  system-vm

emerge -qpvO dev-java/ant-core
[ebuild  N    ] dev-java/ant-core-1.9.13  USE="-doc -source"
Comment 1 Toralf Förster gentoo-dev 2019-01-21 19:05:30 UTC
Created attachment 562442 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2019-01-21 19:05:33 UTC
Created attachment 562444 [details]
dev-java:ant-core-1.9.13:20190121-160051.log
Comment 3 Toralf Förster gentoo-dev 2019-01-21 19:05:36 UTC
Created attachment 562446 [details]
emerge-history.txt
Comment 4 Toralf Förster gentoo-dev 2019-01-21 19:05:38 UTC
Created attachment 562448 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2019-01-21 19:05:41 UTC
Created attachment 562450 [details]
etc.portage.tbz2
Comment 6 Toralf Förster gentoo-dev 2019-01-21 19:05:44 UTC
Created attachment 562452 [details]
temp.tbz2
Comment 7 Miroslav Šulc gentoo-dev 2019-01-23 09:34:33 UTC
i cannot reproduce this error. it might have already been fixed by other fixes i introduced the the ant build system. i will mark it as fixed. if the problem persists, please reopen the issue. also, it would be useful to provide log output using JAVA_PKG_DEBUG=yes emerge ... that in fact would be useful for any java package bug report.
Comment 8 Robert Förster 2019-01-24 13:42:09 UTC
Created attachment 562690 [details]
build.log using JAVA_PKG_DEBUG=yes
Comment 9 Georgy Yakovlev archtester gentoo-dev 2019-01-24 20:33:01 UTC
I can repro on my work machine as well. trying to dig into it.
Comment 10 Miroslav Šulc gentoo-dev 2019-01-24 20:40:35 UTC
(In reply to Georgy Yakovlev from comment #9)
> I can repro on my work machine as well. trying to dig into it.

that'd be great. i looked at the debug output but did not find anything useful to dig out why it fails (under some circumstances).
Comment 11 Miroslav Šulc gentoo-dev 2019-01-24 20:55:14 UTC
maybe i found a difference. this is output from my pc where ant-core compiles without issues:

# env | grep ANT_HOME
ANT_HOME=/usr/share/ant

but i did not find that variable in the attached environment file. that would affect behavior of their build.sh in the following part:

...
REALANTHOME=$ANT_HOME
...
if [ "$REALANTHOME" != "" ]; then
  if $cygwin; then
    REALANTHOME=`cygpath --windows "$REALANTHOME"`
  fi
  ANT_INSTALL="-Dant.install=$REALANTHOME"
else
  ANT_INSTALL="-emacs"
fi

bootstrap/bin/ant -nouserlib -lib lib/optional "$ANT_INSTALL" $*

so in my case the command is this:

bootstrap/bin/ant -nouserlib -lib lib/optional "-Dant.install=/usr/share/ant" $*

on systems where ANT_HOME is not set it would be this:

bootstrap/bin/ant -nouserlib -lib lib/optional "-emacs" $*

maybe that's the difference that causes the issue.
Comment 12 Miroslav Šulc gentoo-dev 2019-01-24 20:59:18 UTC
on my system it's set here:

# grep ANT_HOME /etc/env.d/* -r
/etc/env.d/20ant:ANT_HOME="/usr/share/ant"

and it is installed by ant-core:

# equery belongs /etc/env.d/20ant 
 * Searching for /etc/env.d/20ant ... 
dev-java/ant-core-1.10.5 (/etc/env.d/20ant)

is ant-core already installed when failing or is it a new install?
Comment 13 Georgy Yakovlev archtester gentoo-dev 2019-01-24 21:05:47 UTC
yes, I don't have ant installed yet on that machine.
probably first installation fails like this. chicken-and-egg type of problem.




ebuild unsets ANT_HOME, so it does not play a role from ebuild perspective, moving down to scripts.


build.sh/bootstrap.sh sets it to ANT_HOME="$PWD"/bootstrap

here are commands from unpacked dir:

pwd
/tmp/portage/dev-java/ant-core-1.10.5/work/apache-ant-1.10.5

env ANT_HOME="$PWD"/bootstrap ./bootstrap/bin/ant -nouserlib -lib bootstrap/lib/optional --execdebug
exec "/usr/lib64/icedtea8/bin/java"  -classpath "/usr/share/ant-core/lib/ant-launcher.jar:/usr/lib64/icedtea8/lib/tools.jar"    -Dant.home="/usr/share/ant-core" -Dant.library.dir="/usr/share/ant-core/lib"     org.apache.tools.ant.launch.Launcher    -cp ""  "-nouserlib" "-lib" "bootstrap/lib/optional"
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher



for some reason it sets -Dant.home="/usr/share/ant-core", but it has -Dant.home=\"${ANT_HOME}\"

something goes wrong in the ant script itself.

such a mess...
Comment 14 Miroslav Šulc gentoo-dev 2019-01-24 21:17:01 UTC
i found the cause:

# grep ANT_HOME= bootstrap/bin/ant
ANT_HOME="${EPREFIX}"/usr/share/ant-core

it overrides everything and sets this path. now to find out how to avoid this in case of bootstrap...
Comment 15 Miroslav Šulc gentoo-dev 2019-01-24 21:33:26 UTC
Created attachment 562762 [details, diff]
patch to fix bootstrap

can you please test this patch before i commit it? i changed it to set ANT_HOME only if it is not set. and also changed to /usr/share/ant instead of /usr/share/ant-core to be consistent with env file.
Comment 16 Georgy Yakovlev archtester gentoo-dev 2019-01-24 21:47:53 UTC
nice!

patch worked with dev-java/ant-core-1.10.5

also tested it briefly with other packages, could get maven-bin installed (along with all deps)
Comment 17 Miroslav Šulc gentoo-dev 2019-01-24 21:49:40 UTC
thanks! will update the ant patches and ebuilds and will commit the fix in few minutes.
Comment 18 Larry the Git Cow gentoo-dev 2019-01-24 22:06:20 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9989ce97dabcf6ef399581493ea145409012ccdf

commit 9989ce97dabcf6ef399581493ea145409012ccdf
Author:     Miroslav Šulc <fordfrog@gentoo.org>
AuthorDate: 2019-01-24 22:04:38 +0000
Commit:     Miroslav Šulc <fordfrog@gentoo.org>
CommitDate: 2019-01-24 22:06:08 +0000

    dev-java/ant-core-1.{9.13,10.5}-r1: fixes
    
    1) fixed bug #675992
    2) fixed 'package not found' error on systems wnere ant-core
       is not installed yet
    
    Closes: https://bugs.gentoo.org/675992
    Package-Manager: Portage-2.3.58, Repoman-2.3.12
    Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>

 dev-java/ant-core/Manifest                                            | 4 ++--
 .../ant-core/{ant-core-1.10.5.ebuild => ant-core-1.10.5-r1.ebuild}    | 4 +++-
 .../ant-core/{ant-core-1.9.13.ebuild => ant-core-1.9.13-r1.ebuild}    | 4 +++-
 3 files changed, 8 insertions(+), 4 deletions(-)