The <java> task should check to make sure the directory specified in the
dir attribute exists, and do the nice thing if it doesn't, instead of just
letting java throw an io exception on CreateProcess (which doesn't tell
java neophytes such as myself a whole lot about what could be wrong).
Changing the following lines appears to work (but maybe there's a better
way/place to do it [I've also attached a patch-file I hope is in the right
format to be usable]):
113c113,120
< return run(cmdl.getCommandline());
---
> if (dir != null) {
> if ( ! dir.isDirectory() ) {
> throw new BuildException(dir + " is not a directory.") ;
> }
> }
>
> return run(cmdl.getCommandline());
Specifying a bogus directory then produces:
Buildfile: build.xml
sysinfo:
BUILD FAILED
build.xml:843: D:\dianeh\src\main\foo is not a directory.
Total time: 1 seconds
Diane
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
***
D:/dianeh/work/ant/latest/src/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java
Fri Sep 15 22:03:22 2000
--- Java.java Wed Sep 20 00:52:42 2000
***************
*** 110,116 ****
}
if (fork) {
! return run(cmdl.getCommandline());
} else {
if (cmdl.getVmCommand().size() > 1) {
log("JVM args ignored when same JVM is used.",
Project.MSG_WARN);
--- 110,123 ----
}
if (fork) {
! if (dir != null) {
! if ( ! dir.isDirectory() ) {
! throw new BuildException(dir + " is not a directory.") ;
! }
! }
!
! return run(cmdl.getCommandline());
!
} else {
if (cmdl.getVmCommand().size() > 1) {
log("JVM args ignored when same JVM is used.",
Project.MSG_WARN);