This discussion is archived
4 Replies Latest reply: Nov 19, 2012 11:32 PM by Sascha Herrmann RSS

ojdeploy and Hudson - how do we stop - quick question

901647 Newbie
Currently Being Moderated
Hi All

In our simple script that's used in Hudson, We use ojdeploy -buildfile a.xml -define application.root=/root/test
It works fine when everything compiles but when it fails, the script continues executing with errors which leads to false build status as pass since the shell script runs to the end of file.

How to do use in the shell script with ojdeploy to give a non-0 error number in shell script when ojdeploy fails ?
Any simple concrete example would be great.

Thanks
  • 1. Re: ojdeploy and Hudson - how do we stop - quick question
    Sascha Herrmann Journeyer
    Currently Being Moderated
    You could use the ANT task.

    Are you building on Windows or on a Linux box?

    Sascha
  • 2. Re: ojdeploy and Hudson - how do we stop - quick question
    901647 Newbie
    Currently Being Moderated
    Hi Sascha

    Its a linux box.
  • 3. Re: ojdeploy and Hudson - how do we stop - quick question
    901647 Newbie
    Currently Being Moderated
    Hi Sascha

    do you have a simple sample to show how to use the ant task way ?

    thanks
  • 4. Re: ojdeploy and Hudson - how do we stop - quick question
    Sascha Herrmann Journeyer
    Currently Being Moderated
    In your shell script, you should be able to get the result of the previous process using "$?". So you could evaluate that after calling ojdeploy and if that contains an error code, you should be able to exit your script.

    If you want to use the Ant task, you need to define the task:
      <taskdef name="ojdeploy" classname="oracle.jdeveloper.deploy.ant.OJDeployAntTask" uri="oraclelib:OJDeployAntTask"
                classpath="<put the path to your jdeveloper home here>\jdeveloper\jdev\lib\ant-jdeveloper.jar"/>
    Then you can use ojdeploy (here to run a deployment profile specified in the workspace):
           <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
                        executable="<put the path to your jdeveloper home here>\jdeveloper\jdev\bin\ojdeploy.exe"
                        failonerror="true"
                        ora:buildscript="${WORKSPACE}\build_workspace.xml"
                        ora:statuslog="${WORKSPACE}\build_log.xml">
            <ora:deploy>
              <ora:parameter name="basedir" value="${WORKSPACE}\<directory of the application>"/>
              <ora:parameter name="workspace" value="<name of your workspace file in the basedir>"/>
              <ora:parameter name="profile" value="<deployment profile name>"/>
              <ora:parameter name="outputfile" value="<name of the ear file to be created>"/>
            </ora:deploy>
          </ora:ojdeploy>
    We're building on Windows as you can see, so you might need to adjust the paths and the executable for Linux.

    You might also take a look at:

    http://one-size-doesnt-fit-all.blogspot.fr/2010/11/using-ojdeploy-and-ant-for-creating-adf.html
    http://javaosdev.blogspot.fr/2011/12/ojdeploy-documentation-for-tool.html

    Sascha

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points