jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Continuum
  • CONTINUUM-413

build reported as successful on win xp even when maven 1 build fails

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0
  • Fix Version/s: 1.0.1
  • Component/s: None
  • Labels:
    None
  • Environment:
    Maven 1.0.2
    Java 1.5
    Win XP SP2
    Continuum 1.0
  • Complexity:
    Intermediate

Description

Continuum always reports a successful build even when Maven reports a build failure.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Alan Cabrera added a comment - 02/Nov/05 12:21 PM

I also get this problem w/ Windows Server 2003

Show
Alan Cabrera added a comment - 02/Nov/05 12:21 PM I also get this problem w/ Windows Server 2003
Hide
Permalink
Chad Ellison added a comment - 02/Nov/05 5:42 PM

I've also had this problem w/ Windows XP and Maven 2.

Show
Chad Ellison added a comment - 02/Nov/05 5:42 PM I've also had this problem w/ Windows XP and Maven 2.
Hide
Permalink
Emmanuel Venisse added a comment - 03/Nov/05 3:03 PM

Faqs are updated

Show
Emmanuel Venisse added a comment - 03/Nov/05 3:03 PM Faqs are updated
Hide
Permalink
Chad Ellison added a comment - 03/Nov/05 3:18 PM

The FAQ suggests adding "exit /B errorlevel" to the end of your maven.bat file. I'm running maven 2 and I have "exit /B %ERROR_CODE%" at the end of my mvn.bat file but continuum still thinks every build is a success.

Are there alternate instructions to correct this for Maven 2?

Show
Chad Ellison added a comment - 03/Nov/05 3:18 PM The FAQ suggests adding "exit /B errorlevel" to the end of your maven.bat file. I'm running maven 2 and I have "exit /B %ERROR_CODE%" at the end of my mvn.bat file but continuum still thinks every build is a success. Are there alternate instructions to correct this for Maven 2?
Hide
Permalink
Emmanuel Venisse added a comment - 03/Nov/05 4:01 PM

you need to refresh you page.

content is :
Continuum uses the command line return code for detecting a successful or failed execution.

If you use maven or ant, you need to add at the end of maven.bat and ant.bat, the following lines :

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

and define the MAVEN_TERMINATE_CMD environment var to "on".

Show
Emmanuel Venisse added a comment - 03/Nov/05 4:01 PM you need to refresh you page. content is : Continuum uses the command line return code for detecting a successful or failed execution. If you use maven or ant, you need to add at the end of maven.bat and ant.bat, the following lines : if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% exit /B %ERROR_CODE% and define the MAVEN_TERMINATE_CMD environment var to "on".
Hide
Permalink
Zach B added a comment - 03/Nov/05 7:33 PM

I've tried every conceivable combination of return codes, echo statements, etc. I even tried exiting before @endlocal in the maven.bat script to see if env vars were getting erased before the exit code was returned. I was not able to get a failed maven build to report as a build failure in Continuum. I'm completely confused at this point as to what is either causing the problem, or what specifically is causing the problem for me. I can reproduce at will a non-zero code and echo it as the last command before exiting maven.bat according to windows conventions (exit /B 1)--but still no reported failure.

Show
Zach B added a comment - 03/Nov/05 7:33 PM I've tried every conceivable combination of return codes, echo statements, etc. I even tried exiting before @endlocal in the maven.bat script to see if env vars were getting erased before the exit code was returned. I was not able to get a failed maven build to report as a build failure in Continuum. I'm completely confused at this point as to what is either causing the problem, or what specifically is causing the problem for me. I can reproduce at will a non-zero code and echo it as the last command before exiting maven.bat according to windows conventions (exit /B 1)--but still no reported failure.
Hide
Permalink
Brian Ewins added a comment - 04/Nov/05 9:45 AM

The FAQ answer is incorrect.

The suggestion of setting MAVEN_TERMINATE_CMD to "on" in the environment makes the code do this every time:
exit %ERROR_CODE%
except that ERROR_CODE isn't defined - should have been ERRORLEVEL. Even if it was, this causes exit to be called every time, and without a /B flag that kills off the command window, which is a bit useless outside continuum.

The correct answer is, change continuum's run.bat to begin:
@echo off
set MAVEN_TERMINATE_CMD=on

then add this one line to the end of maven.bat:
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERRORLEVEL%

I've tested this solution, it works.

Show
Brian Ewins added a comment - 04/Nov/05 9:45 AM The FAQ answer is incorrect. The suggestion of setting MAVEN_TERMINATE_CMD to "on" in the environment makes the code do this every time: exit %ERROR_CODE% except that ERROR_CODE isn't defined - should have been ERRORLEVEL. Even if it was, this causes exit to be called every time, and without a /B flag that kills off the command window, which is a bit useless outside continuum. The correct answer is, change continuum's run.bat to begin: @echo off set MAVEN_TERMINATE_CMD=on then add this one line to the end of maven.bat: if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERRORLEVEL% I've tested this solution, it works.
Hide
Permalink
Emmanuel Venisse added a comment - 04/Nov/05 10:14 AM

The faq answer isn't incorrect
ERROR_CODE is a dos env var equivalent to ERRORLEVEL

we have test too the solution written in FAQ and it works.

Show
Emmanuel Venisse added a comment - 04/Nov/05 10:14 AM The faq answer isn't incorrect ERROR_CODE is a dos env var equivalent to ERRORLEVEL we have test too the solution written in FAQ and it works.
Hide
Permalink
Brian Ewins added a comment - 04/Nov/05 11:09 AM

On what version of windows? This is what I see:

G:\>cmd /version
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

  1. get a process to exit with code 0
    G:\>java -version
    java version "1.4.2_03"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
    Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
    G:\>echo %ERRORLEVEL%
    0
    G:\>echo %ERROR_CODE%
    %ERROR_CODE%
  1. note error_code is not defined. now the same, getting java to exit with errors
    G:\>java -garbage
    Unrecognized option: -garbage
    Could not create the Java virtual machine.
    G:\>echo %ERRORLEVEL%
    1
    G:\>echo %ERROR_CODE%
    %ERROR_CODE%

#NB error code still wasn't defined.
I can't see any documentation of ERROR_CODE on microsoft.com either, looking for older versions of cmd.exe/command.com

Show
Brian Ewins added a comment - 04/Nov/05 11:09 AM On what version of windows? This is what I see: G:\>cmd /version Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp.
  1. get a process to exit with code 0 G:\>java -version java version "1.4.2_03" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02) Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode) G:\>echo %ERRORLEVEL% 0 G:\>echo %ERROR_CODE% %ERROR_CODE%
  1. note error_code is not defined. now the same, getting java to exit with errors G:\>java -garbage Unrecognized option: -garbage Could not create the Java virtual machine. G:\>echo %ERRORLEVEL% 1 G:\>echo %ERROR_CODE% %ERROR_CODE%
#NB error code still wasn't defined. I can't see any documentation of ERROR_CODE on microsoft.com either, looking for older versions of cmd.exe/command.com
Hide
Permalink
Brian Ewins added a comment - 04/Nov/05 12:39 PM

Ok, I did more checking (since I did believe you tested this!). This bug was reported against the current /stable/ version of maven1, ie maven 1.0.2. That has maven.bat from immediately prior to this change:
http://svn.apache.org/viewcvs.cgi/maven/maven-1/core/trunk/src/bin/maven.bat?rev=165456&r1=122478&r2=165456
I downloaded a fresh copy of 1.0.2 to make sure I hadn't messed mine up.

This patch added ERROR_CODE as a synonym, as you say. However, I still don't think the FAQ is right. On the bleeding edge of maven1, the code to exit on error is already there, and all that is needed is for continuum to set MAVEN_TERMINATE_CMD, ie the change to run.bat I described above. For maven 1.0.2, support for using ERROR_CODE isn't there and the change in the FAQ isn't enough.

However, from reading up on this, theres a caveat: my change to maven.bat will only work on winXP, win2k3. Documentation on the corresponding ant bug:
http://issues.apache.org/bugzilla/show_bug.cgi?id=13655
shows that the solution needs to be different on win95, NT - incorporating all the changes that are now in maven-1 HEAD.

Show
Brian Ewins added a comment - 04/Nov/05 12:39 PM Ok, I did more checking (since I did believe you tested this!). This bug was reported against the current /stable/ version of maven1, ie maven 1.0.2. That has maven.bat from immediately prior to this change: http://svn.apache.org/viewcvs.cgi/maven/maven-1/core/trunk/src/bin/maven.bat?rev=165456&r1=122478&r2=165456 I downloaded a fresh copy of 1.0.2 to make sure I hadn't messed mine up. This patch added ERROR_CODE as a synonym, as you say. However, I still don't think the FAQ is right. On the bleeding edge of maven1, the code to exit on error is already there, and all that is needed is for continuum to set MAVEN_TERMINATE_CMD, ie the change to run.bat I described above. For maven 1.0.2, support for using ERROR_CODE isn't there and the change in the FAQ isn't enough. However, from reading up on this, theres a caveat: my change to maven.bat will only work on winXP, win2k3. Documentation on the corresponding ant bug: http://issues.apache.org/bugzilla/show_bug.cgi?id=13655 shows that the solution needs to be different on win95, NT - incorporating all the changes that are now in maven-1 HEAD.
Hide
Permalink
Emmanuel Venisse added a comment - 04/Nov/05 2:16 PM

ok, I reopen the issue. We need to provide a new maven.bat for users.

Brian, do you want to to write a patch for maven.bat 1.0.2?
do you have test maven.bat 1.1 script with continuum?

Show
Emmanuel Venisse added a comment - 04/Nov/05 2:16 PM ok, I reopen the issue. We need to provide a new maven.bat for users. Brian, do you want to to write a patch for maven.bat 1.0.2? do you have test maven.bat 1.1 script with continuum?
Hide
Permalink
Emmanuel Venisse added a comment - 07/Nov/05 3:47 AM

I updated FAQ with Brian informations.

We'll provide later a maven.bat file for users

Show
Emmanuel Venisse added a comment - 07/Nov/05 3:47 AM I updated FAQ with Brian informations. We'll provide later a maven.bat file for users
Hide
Permalink
Eric Henson added a comment - 14/Sep/07 2:48 PM

Was there ever a fix for this issue?

I am using:
Continuum 1.1. beta 2
maven-2.0.7
Windows 2003 R2 Standard SP 2
Sun JDK 1.5.0_12

I had to use the %ERRORLEVEL% like Brian mention above on 04/Nov/05 09:45 AM.

Show
Eric Henson added a comment - 14/Sep/07 2:48 PM Was there ever a fix for this issue? I am using: Continuum 1.1. beta 2 maven-2.0.7 Windows 2003 R2 Standard SP 2 Sun JDK 1.5.0_12 I had to use the %ERRORLEVEL% like Brian mention above on 04/Nov/05 09:45 AM.
Hide
Permalink
Emmanuel Venisse added a comment - 14/Sep/07 3:11 PM

A fixed version of maven 2.0.7 mvn.bat is available there: http://svn.apache.org/repos/asf/maven/components/branches/maven-2.0.x/maven-core/src/bin/mvn.bat

Show
Emmanuel Venisse added a comment - 14/Sep/07 3:11 PM A fixed version of maven 2.0.7 mvn.bat is available there: http://svn.apache.org/repos/asf/maven/components/branches/maven-2.0.x/maven-core/src/bin/mvn.bat

People

  • Assignee:
    Emmanuel Venisse
    Reporter:
    Zach B
Vote (1)
Watch (2)

Dates

  • Created:
    02/Nov/05 10:33 AM
    Updated:
    14/Sep/07 3:11 PM
    Resolved:
    07/Nov/05 3:47 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.