Browse Source

Make <javac> use the value of srcdir as destdir if the latter has not

been specified.

Submitted by:	Alexander Pokahr <5pokahr@informatik.uni-hamburg.de>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268075 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
c89099e9b9
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      src/main/org/apache/tools/ant/taskdefs/Javac.java

+ 6
- 3
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -281,20 +281,23 @@ public class Javac extends MatchingTask {
* Executes the task. * Executes the task.
*/ */
public void execute() throws BuildException { public void execute() throws BuildException {
// first off, make sure that we've got a srcdir and destdir
// first off, make sure that we've got a srcdir


if (src == null) { if (src == null) {
throw new BuildException("srcdir attribute must be set!", location); throw new BuildException("srcdir attribute must be set!", location);
} }
String [] list = src.list(); String [] list = src.list();
if (list.length == 0) { if (list.length == 0) {
throw new BuildException("srcdir attribute must be set!", location); throw new BuildException("srcdir attribute must be set!", location);
} }
if (destDir == null) { if (destDir == null) {
throw new BuildException("destdir attribute must be set!", location);
destDir = project.resolveFile(list[0]);
log("destdir set to "+destDir.getPath()+" from srcdir attribute",
Project.MSG_INFO);
} }

if (!destDir.isDirectory()) { if (!destDir.isDirectory()) {
throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location); throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location);
} }


Loading…
Cancel
Save