Argument parse CruiseControl.net to NANT

702 Views Asked by At

Can any one help me with example to pass parameter(Eg:URL) from CruiseControl.net ccnet.config file to NANT name.build file?

below is what I tried(but not succeed)

            **CC.net file** 

            <tasks>
                <nant>
                    <executable>C:\Program Files (x86)\NANT\nant-0.92\bin\nant</executable>
                    <buildFile>C:\Program Files (x86)\NANT\nant-0.92\RiDM.Build</buildFile>

                    <targetList>
                        <target>build</target>
                    </targetList>
                    <buildArgs>-D:myProp=C:\build</buildArgs>

                </nant>
            </tasks>

            **.build file**

            <?xml version="1.0"?>
                <project name="Parameter test File" >
                    <description>Test parameter passing among Cruise control and NANt files.enter code here    </description>


                    <echo message="This is echo" />

                    <if test="${property::exists('myProp')}" />
                                            <echo message="URL: ${myProp}" />
                    <echo message="This is also echo" />

                </project>
2

There are 2 best solutions below

0
On

have you looked at the examples in the scenarios of the CCNet website? http://www.cruisecontrolnet.org/projects/ccnet/wiki/Step_2_Build_on_Check-in at the bottom is a NAnt build script that is used throught the examples.

1
On

Your nant build file is missing a target.

Function calls like echo must be within a target, then specify the target in the buildArgs in cruise control.

See http://nant.sourceforge.net/release/0.91/help/fundamentals/buildfiles.html

Modified nAnt script

<project name="Parameter test File" >
  <description>Test parameter passing among Cruise control and NANt files.enter code here</description>
  <target name="build">
    <echo message="This is echo" />
    <if test="${property::exists('myProp')}">
      <echo message="URL: ${myProp}" />
      <echo message="This is also echo" />
    </if>
  </target>
</project>

nNant will execute the target(s) mention in the targetList element in the ccnet.config, in your case build