pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: How is apache-ant supposed to work?
On Fri, 12 Mar 2021 at 09:24, Jonathan Perkin <jperkin%joyent.com@localhost> wrote:
>
> While I work a lot on OpenJDK packages, I have no real idea how Java
> programs are supposed to function. I'm trying to run the AdoptOpenJDK
> test suite against my updated joyent/openjdk11 package but none of the
> ant packages work:
>
> 1.5.4:
>
> $ pkg_add apache-ant-1.5.4nb2
>
> $ pkg_info -qL apache-ant | grep jar$
> /opt/local/lib/java/ant/ant.jar
> /opt/local/lib/java/ant/optional.jar
>
> $ ant
> Error: Could not find or load main class org.apache.tools.ant.Main
> Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Main
>
> + exec /opt/local/java/openjdk11/bin/java -classpath :/opt/local/lib/java/ant/lib/java/ant/ant.jar:/opt/local/lib/java/ant/lib/java/ant/optional.jar:/opt/local/lib/java/ant/lib/java/crimson.jar -Dant.home=/opt/local/lib/java/ant org.apache.tools.ant.Main
>
> 1.9.13:
>
> $ pkg_add -U apache-ant-1.9.13
>
> $ pkg_info -qL apache-ant | grep jar$
> /opt/local/lib/java/ant/ant-antlr.jar
> /opt/local/lib/java/ant/ant-apache-bcel.jar
> [..lots more in the same directory..]
>
> $ ant
> Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
> Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
>
> + exec /opt/local/java/openjdk11/bin/java -classpath /opt/local/lib/java/ant/lib/java/ant/ant-launcher.jar -Dant.home=/opt/local/lib/java/ant -Dant.library.dir=/opt/local/lib/java/ant/lib/java/ant org.apache.tools.ant.launch.Launcher -cp ''
>
> 1.10.9:
>
> $ pkg_add -U apache-ant-1.10.9
>
> $ pkg_info -qL apache-ant | grep jar$
> /opt/local/lib/java/ant/ant-antlr.jar
> /opt/local/lib/java/ant/ant-apache-bcel.jar
> [..lots more in the same directory..]
>
> $ ant
> Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
> Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
>
> + exec /opt/local/java/openjdk11/bin/java -classpath /opt/local/lib/java/ant/lib/java/ant/ant-launcher.jar -Dant.home=/opt/local/lib/java/ant -Dant.library.dir=/opt/local/lib/java/ant/lib/java/ant org.apache.tools.ant.launch.Launcher -cp ''
>
> The classpath is clearly wrong in all of them, but presumably they work
> fine in other situations otherwise more people would notice.
>
> Would appreciate clue from Java people on how we can fix this so that
> "ant" works as expected for builds outside of pkgsrc, while not breaking
> whatever the other ways of calling it are.
>
> On a related note, should we be looking at switching them to prefixed
> installs and pkg_alternatives?
(Yes, so much yes)
Could there be some difference in the joyent config? From a stock
NetBSD 9 pkgsrc (this is with pkg_alternatives set to both openjdk8
and openjdk11)
(abs@iris ~)11% pkg_info -e apache-ant
apache-ant-1.10.9
(abs@iris ~)14% uname -srm
NetBSD 9.1_STABLE amd64
(abs@iris ~)15% echo '<project><target name="hello"><echo
message="world"/></target></project>' > build.xml && ant --execdebug
-v hello
arg : -v
quoted_arg: "-v"
arg : hello
quoted_arg: "hello"
exec "$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="$ANT_HOME"
-Dant.library.dir="$ANT_LIB" org.apache.tools.ant.launch.Launcher
-cp "$CLASSPATH" "-v" "hello"
Apache Ant(TM) version 1.10.9 compiled on September 27 2020
Trying the default build file: build.xml
Buildfile: /home/abs/build.xml
Detected Java version: 11 in: /usr/pkg/java/openjdk11
Detected OS: NetBSD
parsing buildfile /home/abs/build.xml with URI = file:/home/abs/build.xml
Project base dir set to: /home/abs
Build sequence for target(s) `hello' is [hello]
Complete build sequence is [hello, ]
hello:
parsing buildfile
jar:file:/usr/pkg/lib/java/ant/ant.jar!/org/apache/tools/ant/antlib.xml
with URI = jar:file:/usr/pkg/lib/java/ant/ant.jar!/org/apache/tools/ant/antlib.xml
from a zip file
[echo] world
BUILD SUCCESSFUL
Total time: 1 second
Home |
Main Index |
Thread Index |
Old Index