ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49266] New: ant does not work with empty CLASSPATH
Date Fri, 07 May 2010 19:44:58 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49266

           Summary: ant does not work with empty CLASSPATH
           Product: Ant
           Version: 1.8.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Wrapper scripts
        AssignedTo: notifications@ant.apache.org
        ReportedBy: szeder@ira.uka.de


Have a look at the output of ant commands taken from the ant manual's "Check
Installation" section and the ant website's "Having Problems?" page when they
are executed with an empty CLASSPATH variable (which is even suggested by the
"Having Problems?" page!):

$ unset CLASSPATH
$ ant
The -cp argument must be followed by a classpath expression
$ ant -version
Buildfile: build.xml does not exist!
Build failed
$ ant -diagnostics
Buildfile: build.xml does not exist!
Build failed
$ ant -verbose
Buildfile: build.xml does not exist!
Build failed

This is obviously not good; ant does not even print its version.

The problem is at the end of the bin/ant startup script, where the
ant_exec_command variable is assembled.  The -cp "$CLASSPATH" options are
appended to the command line even when the CLASSPATH is empty, resulting in a
command line which looks like 'exec java ... -cp ""'.  Java then sees the -cp
option without a class path or jar file and errors out, or it sees something
like "... -cp -version" and treats that first argument as a class path or jar
file.

The attached patch resolves this issue by checking CLASSPATH's emptyness and
omiting the -cp option in that case.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message