开发者

CruiseControl "Unused node detected" error when adding xmlns to Project node

I am trying to use the Cruise Control preprocessor functionality to break my configuration into smaller reusable sections. I can use the include featu开发者_如何学Pythonre great from within the root cruisecontrol node, like so:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
    <cb:include href="child.config" />
</cruisecontrol>

If I try and use another include within the child config (like so):

<project name="TestProject" xmlns:cb="urn:ccnet.config.builder">    
    <cb:include href="grandchild.config" />
</project>

I get the following error:

ThoughtWorks.CruiseControl.Core.Config.ConfigurationException: Unused node detected: xmlns:cb="urn:ccnet.config.builder"

If I remove the xmlns namespace statement, I get this error instead:

ThoughtWorks.CruiseControl.Core.Config.ConfigurationException: The configuration file contains invalid xml: E:\Build\Config\AppRiver.Tools.BuildAutomation\CruiseControl\ccnet.config ---> System.Xml.XmlException: 'cb' is an undeclared namespace.

And lastly, if I remove the "cb" prefix on the tag, I get this error

Unused node detected:     Unused node detected: <define buildFile="CP.WEB.Dev.SanityCheck.CI.build" />

I am out of ideas - any help appreciated!


To use <cb:include> the <cb:include> tag must have the xml namespace defined AND the included files must start with a element with the xml namespace defined in it. This is in the documentation but is easy to miss.

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
  <cb:include href="projectFile.xml" xmlns:cb="urn:ccnet.config.builder"/>
</cruisecontrol>

projectFile.xml

<cb:config-template xmlns:cb="urn:ccnet.config.builder">
  <project>
      ...
  </project>
</cb:config-template>

Additionally, if you're adding ccnet version information as noted here, you need to include that namespace in the included file as well.

So the ccnet.config looks like:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder" xmlns="http://thoughtworks.org/ccnet/1/8">
  <cb:include href="projectFile.xml" xmlns:cb="urn:ccnet.config.builder"/>
</cruisecontrol>

and projectFile.xml changes to

<cb:config-template xmlns:cb="urn:ccnet.config.builder" xmlns="http://thoughtworks.org/ccnet/1/8">
  <project>
      ...
  </project>
</cb:config-template>


This isn't necessarily a problem with the way you are including a file. It is a more generic error. I ran into the problem when accidentally missing a tag out in a source control statement.

I think it is used to mean the xml you inserted wasn't understood by the element you tried to use it in

I accidentally had this (which works for multi source control):

<cb:define name="Hg">
    <repo>$(repo)</repo>
    <executable>$(hgExePath)</executable>
    <branch>default</branch>
    <workingDirectory>$(dir)</workingDirectory>
</cb:define>

Being used in something like this:

<cb:define name="SourceControl">
    <sourcecontrol type="hg">
        <cb:Hg repo="$(repo)" dir="." />
    </sourcecontrol>
</cb:define>

Because sourcecontrol (the native ccnet one) was already specifying type="hg" it wasn't expecting to see the hg element


Try removing the included grandchild from within the Project tags. Also, we include xmlns:cb="urn:ccnet.config.builder" in our Include tag.

<cb:include href="grandchild.config" xmlns:cb="urn:ccnet.config.builder"/>


Cruise Control throws an error if an xmlns is put on the project tag. This seems to be a bug. I have now moved off Cruise Control and onto Hudson, and very happy with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜