Browse Source

fix for bugzilla 43121 - war task inconsistent bahaviour

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@567744 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
7896dac845
3 changed files with 20 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/War.java
  3. +15
    -0
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 3
- 0
WHATSNEW View File

@@ -136,6 +136,9 @@ Fixed bugs:
* <junit> supports collecting and rerunning failed test cases
(textXXX methods). Bugzilla 42984.

* War task failed with "No WEB-INF/web.xml file was added" when called
a second time. Bugzilla 43121.

Other changes:
--------------
* <script> now has basic support for JavaFX scripts


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/War.java View File

@@ -219,7 +219,8 @@ public class War extends Jar {
if (addedWebXmlFile == null
&& deploymentDescriptor == null
&& needxmlfile
&& !isInUpdateMode()) {
&& !isInUpdateMode()
&& hasUpdatedFile()) {
throw new BuildException("No WEB-INF/web.xml file was added.\n"
+ "If this is your intent, set needxmlfile='false' ");
}


+ 15
- 0
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -97,6 +97,10 @@ public class Zip extends MatchingTask {

// CheckStyle:VisibilityModifier ON

// This boolean is set if the task detects that the
// target is outofdate and has written to the target file.
private boolean updatedFile = false;

/**
* true when we are adding new files into the Zip file, as opposed
* to adding back the unchanged files
@@ -411,6 +415,16 @@ public class Zip extends MatchingTask {
}
}

/**
* Get the value of the updatedFile attribute.
* This should only be called after executeMain has been
* called.
* @return true if executeMain has written to the zip file.
*/
protected boolean hasUpdatedFile() {
return updatedFile;
}

/**
* Build the zip file.
* This is called twice if doubleFilePass is true.
@@ -450,6 +464,7 @@ public class Zip extends MatchingTask {
if (!state.isOutOfDate()) {
return;
}
updatedFile = true;
if (!zipFile.exists() && state.isWithoutAnyResources()) {
createEmptyZip(zipFile);
return;


Loading…
Cancel
Save