2012-09-07 32 views
1

目前我CruiseControl.NET郵件發佈者有其用戶生成的配置文件的硬編碼的列表填充CruiseControl的電子郵件發佈者用戶從文件地址

<publishers> 
    [ ... ] 
    <email from="[email protected]" mailhost="stmp.domain.com" mailport="25" includeDetails="TRUE"> 
     <replyto>[email protected]</replyto> 
     <users> 
      <user name="a.user" group="buildmaster" address="[email protected]"/> 
      <user name="b.user" group="developers" address="[email protected]"/> 
     </users> 
     <groups> 
      <group name="developers"> 
       <notifications> 
        <notificationType>Failed</notificationType> 
        <notificationType>Fixed</notificationType> 
       </notifications> 
      </group> 
      <group name="buildmaster"> 
       <notifications> 
        <notificationType>Always</notificationType> 
       </notifications> 
      </group> 
     </groups> 
     <modifierNotificationTypes> 
      <NotificationType>Failed</NotificationType> 
      <NotificationType>Fixed</NotificationType> 
     </modifierNotificationTypes> 
    </email> 
</publishers> 

我希望能夠讀來自外部文件的用戶列表。我們有幾十個構建文件,我想簡化添加新用戶和刪除不再感興趣的過程。

我可以這樣做嗎?

回答

2

是的 - 只要看看配置預處理器,特別是在Include部分。

您可以將<users/>節點移動到一個單獨的文件中,例如, email_users.xml並保持它在一個地方,然後就包括它<cb:include href="email_users.xml"/>

樣品email_users.xml文件:

<?xml version="1.0" encoding="utf-8"?> 
<cb:config-template xmlns:cb="urn:ccnet.config.builder" 
    xmlns="http://thoughtworks.org/ccnet/1/5"> 
    <users> 
    <user name="a.user" group="buildmaster" address="[email protected]"/> 
    <user name="b.user" group="developers" address="[email protected]"/> 
    </users> 
</cb:config-template> 

請記住,對於這個工作,你的主文件應該開始

<cruisecontrol xmlns:cb="urn:ccnet.config.builder" 
    xmlns="http://thoughtworks.org/ccnet/1/5"> 
+0

這正是我所追求的,謝謝。 – Unsliced

相關問題