如何使用CruiseControl.NET中的发布者合并文件

时间:2013-10-11 01:30:29

标签: xml merge cruisecontrol.net nant ccnet-config

刚开始使用CruiseControl.NET处理我们正在处理的小项目,而且我在将XML文件合并到构建完成后运行的电子邮件发布者时遇到了问题。

根据我的阅读,我需要确保合并标记出现在xml记录器之前,并且文件必须存在于指定的位置,这就是我在下面所做的。

<merge>
     <files>
         <file>C:\CCNet\xxx.xml</file>
     </files>
</merge>    
<xmllogger />

我正在尝试合并的文件最初是NAnt / NUnit输出的结果,但是在尝试诊断问题时,我通过合并上述静态XML文件从已知位置和仍然有同样的问题。

XML必须采用特定格式吗?我是不是要加载一个XSL文件,以便电子邮件发布者知道如何显示它?

如果需要,可以使用完整的构建脚本。

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
    <cb:define MainDir="C:\CCNet"/>
    <cb:define WorkingDir="Working"/>
    <cb:define ReleaseDir="Release"/>
    <cb:define ArtifactsDir="BuildArtifacts"/>
    <cb:define StateDir="State"/>

    <cb:define name="BuildTask">
        <nant>
            <baseDirectory>$(MainDir)\$(WorkingDir)\NaturalTalent\$(Build)</baseDirectory>
            <executable>C:\Program Files\nant-0.92\bin\NAnt.exe</executable>
            <buildFile>default.build</buildFile>                
            <buildArgs>-D:CCNetReleaseDirectory=$(MainDir)\$(ReleaseDir)\NaturalTalent\$(Build)</buildArgs>
        </nant> 
    </cb:define>

    <cb:define name="CommonProjectSettings">
        <state type="state" directory="$(MainDir)\$(StateDir)" />
        <workingDirectory>$(MainDir)\$(WorkingDir)\NaturalTalent\$(Build)</workingDirectory>
        <artifactDirectory>$(MainDir)\$(ArtifactsDir)\NaturalTalent\$(Build)</artifactDirectory>

        <sourcecontrol type="git">
            <repository>http://cruizecontrol:password@192.168.1.155/gitlab/nga.git</repository>
            <workingDirectory>$(MainDir)\$(WorkingDir)\NaturalTalent\$(Build)</workingDirectory>
        </sourcecontrol>

        <publishers>
            <merge>
                 <files>
                     <file>C:\CCNet\xxx.xml</file>
                 </files>
            </merge>        

            <statistics />
            <xmllogger />
            <artifactcleanup cleanUpMethod="KeepLastXBuilds" cleanUpValue="50" />

            <email from="ccnet@nga.net" mailhost="bart" mailport="25" includeDetails="true">
                <users>
                    <cb:Users />
                </users>
                <groups>
                    <group name="developers">
                      <notifications>
                        <notificationType>Failed</notificationType>
                        <notificationType>Fixed</notificationType>
                      </notifications>
                    </group>
                    <group name="buildmaster">
                      <notifications>
                        <notificationType>Always</notificationType>
                      </notifications>
                    </group>
                </groups>
                <xslFiles>
                    <file>xsl\header.xsl</file>
                    <file>xsl\compile.xsl</file>
                    <file>xsl\modifications.xsl</file>                  
                  </xslFiles>               
            </email>
        </publishers>           
    </cb:define>

    <project name="NaturalTalent (TRUNK) - Latest">
        <cb:scope Build="Latest">
            <cb:define name="Users">
                <user name="Anton Felich" group="buildmaster" address="anton.felich@nga.net" />
                <!--<user name="David Ames" group="buildmaster" address="david.ames@nga.net" />
                <user name="David Ames" group="buildmaster" address="davidames76@gmail.com" />-->
            </cb:define>

            <cb:CommonProjectSettings />

            <tasks>
                <cb:BuildTask />
            </tasks>                        

            <triggers>
                <intervalTrigger name="continuous" seconds="30" buildCondition="IfModificationExists" initialSeconds="5"/>
            </triggers>
        </cb:scope>
    </project>

    <project name="NaturalTalent (TRUNK) - Nightly">
        <cb:scope Build="Nightly">
            <cb:define name="Users">
                <user name="Anton Felich" group="buildmaster" address="anton.felich@nga.net" />
                <!--<user name="David Ames" group="buildmaster" address="david.ames@nga.net" />-->
                <!--<user name="David Ames" group="buildmaster" address="davidames76@gmail.com" />
                <user name="HouTan" group="buildmaster" address="hou.tan@nga.net" />
                <user name="MickHutchinson" group="buildmaster" address="mick.hutchinson@nga.net" />
                -->
            </cb:define>                    

            <tasks>
                <cb:BuildTask />
                <nant>
                    <baseDirectory>$(MainDir)\$(WorkingDir)\NaturalTalent\$(Build)</baseDirectory>
                    <executable>C:\Program Files\nant-0.92\bin\NAnt.exe</executable>
                    <buildFile>default.build</buildFile>                
                    <buildArgs>-D:CCNetReleaseDirectory=$(MainDir)\$(ReleaseDir)\NaturalTalent\$(Build)</buildArgs>
                    <targetList>
                        <target>test</target>
                    </targetList>                   
                </nant>         
            </tasks>                        

            <cb:CommonProjectSettings />
        </cb:scope>

        <triggers>
            <scheduleTrigger time="23:30" buildCondition="ForceBuild" name="Nightly" />
        </triggers>
    </project>
</cruisecontrol>

1 个答案:

答案 0 :(得分:1)

只要xml文件包含格式正确的xml(应该是这样)......“吸入到build.xml中的所有内容应该可以正常工作。” p>

由于你是新手,我猜你可能没有正确设置目录。

下载此工具:

http://www.voidtools.com/download.php

搜索“xxx.xml”........然后确保该任务的目录正确无误。

PS,您可以使用通配符作为文件名(如下所示),这就是我所做的。

  <publishers>
    <merge>
      <files>


     <file>C:\ExactFolderWhereThisFileExists\*RESULTS.xml</file>              


      </files>
    </merge>