Author: peterreilly Date: Mon Aug 20 09:34:24 2007 New Revision: 567744 URL: http://svn.apache.org/viewvc?rev=567744&view=rev Log: fix for bugzilla 43121 - war task inconsistent bahaviour
Modified: ant/core/trunk/WHATSNEW ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=567744&r1=567743&r2=567744&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Mon Aug 20 09:34:24 2007 @@ -136,6 +136,9 @@ * <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 Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java?rev=567744&r1=567743&r2=567744&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java Mon Aug 20 09:34:24 2007 @@ -219,7 +219,8 @@ 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' "); } Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=567744&r1=567743&r2=567744&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Mon Aug 20 09:34:24 2007 @@ -97,6 +97,10 @@ // 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 @@ -412,6 +416,16 @@ } /** + * 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. * @throws BuildException on error @@ -450,6 +464,7 @@ if (!state.isOutOfDate()) { return; } + updatedFile = true; if (!zipFile.exists() && state.isWithoutAnyResources()) { createEmptyZip(zipFile); return; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]