Hi Mike,

The conditional element is a task element - this means it needs to be inside
a <prebuild>, <tasks> or <publishers> element. The following example shows
this:
  <project name="9iCompile">
    <sourcecontrol xsi:type="svn">
      <trunkUrl>http://bis-build:81/svn/Oracle/oas_forms/COPEN</trunkUrl>
      <workingDirectory>C:\OAS\COPEN</workingDirectory>
      <username>xxx</username>
      <password>xxx</password>
      <executable>C:\Program Files\VisualSVN\bin\svn.exe</executable>
    </sourcecontrol>
    <tasks>
      <!-- 
      A conditional is a task type, so it needs to be in either the tasks
      or publishers element
      -->
      <conditional>
        <conditions>
          <compareCondition>
            <value1>$[ProjectType]</value1>
            <value2>copen</value2>
            <evaluation>equal</evaluation>
            <ignoreCase>true</ignoreCase>
          </compareCondition>
        </conditions>
        <tasks>
          <nant>
            <executable>C:\Program Files\nant-0.85\bin\nant.exe</executable>
            <baseDirectory>C:\OAS</baseDirectory>
            <buildFile>Oracle9i_Automation_v2.build</buildFile>
            <targetList>
              <target>build</target>
            </targetList>
          </nant>
        </tasks>
      </conditional>
    </tasks>

    <!-- more conditional statements would be here for different project
types if I can get it to work -->

    <parameters>
      <selectParameter name="ProjectType">
        <description>The type of project to operate on.</description>
        <allowedValues>
          <value name="COPEN">copen</value>
          <value name="BCS">bcs</value>
          <value name="FCDD">fcdd</value>
        </allowedValues>
      </selectParameter>
    </parameters>

    <security type="defaultProjectSecurity" defaultRight="Deny">
      <permissions>
        <rolePermission name="Developers" ref="Developers"/>
        <rolePermission name="Accepters" ref="Accepters"/>
        <rolePermission name="Releasers" ref="Releasers"/>
        <rolePermission name="Administrators" ref="Administrators"/>
      </permissions>
    </security>
  </project>


Craig

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Mike M
Sent: Tuesday, 4 May 2010 7:35 p.m.
To: ccnet-user
Subject: [ccnet-user] Re: Conditional Plugin Not Functioning??

I just realised that I made a pasting error in the above code and
there is no </selectParameter> closing statement. This is in the
original code though so it is not the reason for the error.

On May 3, 12:40 pm, Mike M <[email protected]> wrote:
> Hi all,
>
> I cannot get the conditional plugin to work. I am running the latest
> version of CCNet (1.6.7258.1) and have the following code:
>
>  <project name="9iCompile">
>
>     <sourcecontrol type="svn">
>       <trunkUrl>http://bis-build:81/svn/Oracle/oas_forms/COPEN</
> trunkUrl>
>       <workingDirectory>C:\OAS\COPEN</workingDirectory>
>       <username>xxx</username>
>       <password>xxx</password>
>       <executable>C:\Program Files\VisualSVN\bin\svn.exe</executable>
>     </sourcecontrol>
>
>     <conditional>
>
>       <conditions>
>         <compareCondition>
>           <value1>$[ProjectType]</value1>
>           <value2>copen</value2>
>           <evaluation>equal</evaluation>
>           <ignoreCase>true</ignoreCase>
>         </compareCondition>
>       </conditions>
>
>       <tasks>
>       <nant>
>         <executable>C:\Program Files\nant-0.85\bin\nant.exe</
> executable>
>         <baseDirectory>C:\OAS</baseDirectory>
>         <buildFile>Oracle9i_Automation_v2.build</buildFile>
>         <targetList>
>           <target>build</target>
>         </targetList>
>       </nant>
>       </tasks>
>
>     </conditional>
>
>     <!-- more conditional statements would be here for different
> project types if I can get it to work -->
>
>     <parameters>
>       <selectParameter name="ProjectType">
>         <description>The type of project to operate on.</description>
>         <allowedValues>
>           <value name="COPEN">copen</value>
>           <value name="BCS">bcs</value>
>           <value name="FCDD">fcdd</value>
>         </allowedValues>
>     </parameters>
>
>     <security type="defaultProjectSecurity" defaultRight="Deny">
>       <permissions>
>         <rolePermission name="Developers" ref="Developers"/>
>         <rolePermission name="Accepters" ref="Accepters"/>
>         <rolePermission name="Releasers" ref="Releasers"/>
>         <rolePermission name="Administrators" ref="Administrators"/>
>       </permissions>
>     </security>
>
>   </project>
>
> The CCNet server crashes whenever I try to run this config though with
> the following output:
>
> [14:ERROR] Exception: Unused node detected:
> <conditional>
>         <conditions><compareCondition><value1>$[ProjectType]</
> value1><value2>copen</value2><evaluation>equal</
> evaluation><ignoreCase>true</ignoreCase></compareCondition></
> conditions>
>         <tasks><nant><executable>C:\Program Files\nant-0.85\bin\nant.exe</
> executable><baseDirectory>C:\OAS</
> baseDirectory><buildFile>Oracle9i_Automation_v2.build</
> buildFile><targetList><target>build</target></targetList></nant></
> tasks>
> </conditional>
> ----------
> ThoughtWorks.CruiseControl.Core.Config.ConfigurationException: Unused
> node detected:
> <conditional><conditions><compareCondition><value1>$[ProjectType]</
> value1><value2>copen</value2><evaluation>equal</
> evaluation><ignoreCase>true</ignoreCase></conditions>
> <tasks><nant><executable>C:\Program Files\nant-0.85\bin\nant.exe</
> executable><baseDirectory>C:\OAS</
> baseDirectory><buildFile>Oracle9i_Automation_v2.build</
> buildFile><targetList><target>build</target></targetList></nant></
> tasks></conditional>
>
>    at
>
ThoughtWorks.CruiseControl.Core.Config.NetReflectorConfigurationReader.Defa­
ultErrorProcesser.ProcessError(String
> message)
>    at
>
ThoughtWorks.CruiseControl.Core.Config.NetReflectorConfigurationReader.<>c_­
_DisplayClass1.<Read>b__0(InvalidNodeEventArgs
> args)
>    at
>
Exortech.NetReflector.InvalidNodeEventHandler.Invoke(InvalidNodeEventArgsar­
gs)
>    at
>
Exortech.NetReflector.NetReflectorTypeTable.OnInvalidNode(InvalidNodeEventA­
rgs
> args)
>    at
>
Exortech.NetReflector.XmlTypeSerialiser.HandleUnusedNode(NetReflectorTypeTa­
ble
> table, XmlNode orphan)
>    at Exortech.NetReflector.XmlTypeSerialiser.ReadMembers(XmlNode
> node, Object instance, NetReflectorTypeTable table)
>    at Exortech.NetReflector.XmlTypeSerialiser.Read(XmlNode node,
> NetReflectorTypeTable table)
>    at Exortech.NetReflector.NetReflectorReader.Read(XmlNode node)
>    at
>
ThoughtWorks.CruiseControl.Core.Config.NetReflectorConfigurationReader.Read­
(XmlDocument
> document, IConfigurationErrorProcesser errorProcesser)
>    at
>
ThoughtWorks.CruiseControl.Core.Config.DefaultConfigurationFileLoader.Load(­
FileInfo
> configFile)
>    at
> ThoughtWorks.CruiseControl.Core.Config.FileConfigurationService.Load()
>    at
>
ThoughtWorks.CruiseControl.Core.Config.FileWatcherConfigurationService.Load­
()
>    at
> ThoughtWorks.CruiseControl.Core.Config.CachingConfigurationService.Load()
>    at ThoughtWorks.CruiseControl.Core.CruiseServer.Restart()
>    at
> ThoughtWorks.CruiseControl.Core.Config.ConfigurationUpdateHandler.Invoke()
>    at
>
ThoughtWorks.CruiseControl.Core.Config.FileWatcherConfigurationService.Hand­
leConfigurationFileChanged(Object
> source, FileSystemEventArgs args)
> ----------
>
> Can someone please help?? I have no idea what I'm doing wrong here or
> if this is a bug :(

Reply via email to