Hi, I redid the patch that handles an invalid pomversion better (catches the numberformatexception thrown and shows a "nice" message saying what was wrong).
Also the patch which allows to no fail on the testscases, but just continue building the system. The -1 that was there, was changed to -0. They are both included in one diff. Mvgr, Martin van den Bemt
Index: src/java/org/apache/maven/UpdatePomCheck.java =================================================================== RCS file: /home/cvspublic/jakarta-turbine-maven/src/java/org/apache/maven/UpdatePomCheck.java,v retrieving revision 1.6 diff -u -r1.6 UpdatePomCheck.java --- src/java/org/apache/maven/UpdatePomCheck.java 3 Jun 2002 03:44:56 -0000 1.6 +++ src/java/org/apache/maven/UpdatePomCheck.java 4 Jun 2002 22:29:23 -0000 @@ -61,6 +61,8 @@ import org.apache.maven.project.Project; import org.apache.maven.executor.AbstractExecutor; +import org.apache.tools.ant.BuildException; + /** * XML project descriptor validator. This tasks exposes 4 Ant properties : * <ul> @@ -83,6 +85,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> * @author dion * @author <a href="[EMAIL PROTECTED]">Vincent Massol</a> + * @author <a href="[EMAIL PROTECTED]">Martin van den Bemt</a> * @version $Id: UpdatePomCheck.java,v 1.6 2002/06/03 03:44:56 dion Exp $ */ public class UpdatePomCheck extends AbstractExecutor @@ -135,21 +138,31 @@ { project.setPomVersion("1"); } - - if (Integer.parseInt(project.getPomVersion()) != - MavenConstants.POM_VERSION) + try { - getProject().setProperty("maven.pomUpdateRequired", "true"); - getProject().setProperty("maven.fromVersion", - project.getPomVersion()); - getProject().setProperty("maven.toVersion", - Integer.toString(MavenConstants.POM_VERSION)); - - log("maven.fromVersion -> " + project.getPomVersion(), - org.apache.tools.ant.Project.MSG_DEBUG); - log(" maven.toVersion -> " + MavenConstants.POM_VERSION, - org.apache.tools.ant.Project.MSG_DEBUG); + if (Integer.parseInt(project.getPomVersion()) != + MavenConstants.POM_VERSION) + { + getProject().setProperty("maven.pomUpdateRequired", "true"); + getProject().setProperty("maven.fromVersion", + project.getPomVersion()); + getProject().setProperty("maven.toVersion", + Integer.toString(MavenConstants.POM_VERSION)); + + log("maven.fromVersion -> " + project.getPomVersion(), + org.apache.tools.ant.Project.MSG_DEBUG); + log(" maven.toVersion -> " + MavenConstants.POM_VERSION, + org.apache.tools.ant.Project.MSG_DEBUG); + } + } + catch(NumberFormatException nfe) + { + // we have to also log it to the screen, + // since ant 1.4 and smaller doensn't + // unwrap the InvocationTargetException. + System.out.println("ERROR!! : Specified version "+project.getPomVersion()+" is not a valid POM Number"); + throw new BuildException("Specified version "+project.getPomVersion()+" is not a valid POM Number"); } // Let the build system know that we have checked the POM. Index: src/templates/build/plugins/test/build.xml =================================================================== RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/test/build.xml,v retrieving revision 1.3 diff -u -r1.3 build.xml --- src/templates/build/plugins/test/build.xml 4 Jun 2002 15:26:24 -0000 1.3 +++ src/templates/build/plugins/test/build.xml 4 Jun 2002 22:29:25 -0000 @@ -118,7 +118,7 @@ <target name="do-test" depends="run-tests" - if="maven.test.failure"> + if="maven.test.failure" unless="maven.test.dontfailontests"> <fail message="There were unit test failures."/> Index: xdocs/ref/properties.xml =================================================================== RCS file: /home/cvspublic/jakarta-turbine-maven/xdocs/ref/properties.xml,v retrieving revision 1.21 diff -u -r1.21 properties.xml --- xdocs/ref/properties.xml 4 Jun 2002 20:11:23 -0000 1.21 +++ xdocs/ref/properties.xml 4 Jun 2002 22:29:27 -0000 @@ -548,6 +548,16 @@ unit testing. The default value is <code>8192</code>. </td> </tr> + <tr> + <td>maven.test.dontfailontests</td> + <td>Yes</td> + <td> + Specifies wheather you want to fail the build if a test + fails. The default is to fail the build. This property + is not used for integration unit tests. + tests. + </td> + </tr> </table> </section> <section name="Checkstyle Settings">
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
