CruiseControl "Unused node detected" error when adding xmlns to Project node
Asked Answered
M

4

5

I am trying to use the Cruise Control preprocessor functionality to break my configuration into smaller reusable sections. I can use the include feature 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!

Mittel answered 14/7, 2011 at 19:6 Comment(8)
Please show your grandchild.config as well. Also, did you try checking your configuration with the included validator?Backler
I ended up having to add the xmlns to every include and define tag, and create a custom namespace for each! Like so: <cbgrandchild:include href="grandchild.config" xmlns:cbgrandchild="urn:ccnet.config.builder" />. Not great. I am finding that CruiseControl is great when all the config is in one file, but it is very hard to split it up to cater for very large projects and multiple teams. I am not flagging this as the answer, as I hope someone comes along with a better one!Mittel
skolima - to answer your question, the contents of the grandchild are, for my testing purposed, just the "publishers" section of CC config. No, I have not tested against the included validator - not sure how to do that. Will follow up.Mittel
The namespace declaration should be on the root element in the included files, not on the <cb:include /> . Also, are you sure you have a single root element in the included file?Backler
Project is the single root element. Cruise Control throws an error if an xmlns is put on this tag. This is the crux of the problem!Mittel
Try using confluence.public.thoughtworks.org/display/CCNET/CCValidator . If this still doesn't help, I'll post some examples that I have working with nested inclusions - I just can't access them before Monday. Also - are you using 1.6? I haven't tried it out yet.Backler
I have verified that I'm running code virtually identical to yours on 1.5.7385.114 and it works. Just a small difference (which should not matter): my grandchild files either start with <?xml version="1.0" encoding="utf-8"?> or the content is wrapped in <cb:scope xmlns:cb="urn:ccnet.config.builder">.Backler
Just noticed your comment. Thanks for your follow up and that link. In my frustration I have subsequently moved over to Hudson CI Server, and am very happy with it. For closure on this thread I will try to go back and test with your suggestions and that validator, and post the outcome.Mittel
M
1

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.

Mittel answered 6/9, 2011 at 16:4 Comment(0)
B
5

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>
Baklava answered 9/8, 2012 at 17:21 Comment(1)
Very well. I had to upgrade a 1.5 server to 1.8 and projects would fail with this error; the included files had <project> defined at the top level. Wrapping inside the cb:config-template worked. +1. Thanks!Oconnor
D
2

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

Dufrene answered 10/6, 2014 at 14:35 Comment(0)
S
1

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"/>
Strongwilled answered 14/7, 2011 at 19:18 Comment(2)
I don't want to remove the grandchild tag from the project tag - as my goal is to componentize the different sections so they can be reused across configurations (such as the publishers section). If I include the XMLNS on the include tag, it complains if i use another tag with the same xmlns in the same doc. I can create different namespaces for each, but this is not very maintainable, and a bit of a hack.Mittel
I think the problems is that CC sees an XMLNS as an attribute that it does not know about, and blows up. This seems like a bug to me.Mittel
M
1

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.

Mittel answered 6/9, 2011 at 16:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.