ant fails with "Unknown argument: -cp"

Bug #207105 reported by Michael Shapiro
6
Affects Status Importance Assigned to Milestone
ant (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: ant

There is an error in ant's launch script:

/usr/share/ant/bin/ant

the line defining the ant launch command erroneously uses the flag "-cp" where it should have used "-lib".

Fix:

Change

ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

to

ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -lib \"$CLASSPATH\" $ant_exec_args"

Further information:

$ lsb_release -rd
Description: Ubuntu 7.10
Release: 7.10

$ apt-cache policy ant
ant:
  Installed: 1.7.0-3
  Candidate: 1.7.0-3
  Version table:
 *** 1.7.0-3 0
        500 http://us.archive.ubuntu.com gutsy/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
Michael Koch (konqueror) wrote :

According to the sources in Launcher.java using -cp is correct. Can you please add a use case where we can reproduce your failure?
I'm not able to reproduce your "Unknown argument: -cp".

Revision history for this message
Michael Shapiro (koudelka) wrote :

Thing is that it doesn't need a use case...

mshapiro@b5:~$ sudo apt-get install ant
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  ant-doc
Recommended packages:
  ant-optional ant-gcj
The following NEW packages will be installed:
  ant
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 0B/1281kB of archives.
After unpacking 1495kB of additional disk space will be used.
Selecting previously deselected package ant.
(Reading database ... 120039 files and directories currently installed.)
Unpacking ant (from .../archives/ant_1.7.0-3_all.deb) ...
Setting up ant (1.7.0-3) ...

mshapiro@b5:~$ ant
Unknown argument: -cp
ant [options] [target [target2 [target3] ...]]
Options:
  -help, -h print this message
  -projecthelp, -p print project help information
  -version print the version information and exit
  -diagnostics print information that might be helpful to
                         diagnose or report problems.
  -quiet, -q be extra quiet
  -verbose, -v be extra verbose
  -debug, -d print debugging information
  -emacs, -e produce logging information without adornments
  -lib <path> specifies a path to search for jars and classes
  -logfile <file> use given file for log
    -l <file> ''
  -logger <classname> the class which is to perform logging
  -listener <classname> add an instance of class as a project listener
  -noinput do not allow interactive input
  -buildfile <file> use given buildfile
    -file <file> ''
    -f <file> ''
  -D<property>=<value> use value for given property
  -keep-going, -k execute all targets that do not depend
                         on failed target(s)
  -propertyfile <name> load all properties from file with -D
                         properties taking precedence
  -inputhandler <class> the class which will handle input requests
  -find <file> (s)earch for buildfile towards the root of
    -s <file> the filesystem and use it
  -nice number A niceness value for the main thread:
                         1 (lowest) to 10 (highest); 5 is the default

It gives the error then prints out the usage instructions.

Are you using 1.7.0-3?

Revision history for this message
Michael Koch (konqueror) wrote :

mkoch@quadriga:~$ ant
Buildfile: build.xml does not exist!
Build failed

mkoch@quadriga:~$ ant -cp
The -cp argument must be followed by a classpath expression

mkoch@quadriga:~$ dpkg -l ant
ii ant 1.7.0-5 Java based build tool like make

The differences to 1.7.0-3 are minimalistic and should not affect this behaviour. At least I cannot remember it when using older ant versions.

Revision history for this message
Michael Shapiro (koudelka) wrote :

Erg, I'm sorry, my ANT_HOME was set incorrectly... the default configuration at my job is really crap.

Safe to close the bug.

Chris Jones (cmsj)
Changed in ant:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.