Leo
Leo

Reputation: 399

Argument parse CruiseControl.net to NANT

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>

Upvotes: 0

Views: 692

Answers (2)

Simon Laing
Simon Laing

Reputation: 1214

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

Upvotes: 1

Williams
Williams

Reputation: 741

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.

Upvotes: 2

Related Questions