2010-12-01 10 views
0

私のwebappには、以下のようにdbパスワードを指定するhibernate設定ファイルがあります。antビルドファイルのdbパスワードを指定します

 
<property name="hibernate.connection.password">p1ssw2rd</property> 
ビルドファイルもあります。ビルド時にdbパスワードを指定してから休止状態?

 

    <target name="init-development"> 

     <property name="databasePassword" value="xxxx"/> 
    </target> 

答えて

2

あなたはこのように、パスワードのラベルに設定を休止テンプレートを作成することができます。

<property name="hibernate.connection.password">@@[email protected]@</property> 

とAntビルドを開始すると、指定された実際のDBのパスワードを使用して交換用のパスワードラベルを適用し、実際の休止状態の設定を超えるテンプレートの設定をコピーしますbuild.xmlにあります。 それはそのようなものです:D それは

の作品:私はreplaceString

のためのセクション <replacetokens> <token key="@@[email protected]@" value="${databasePassword}"/> </replacetokens>

を変更

<copy file="${src.dir}/hibernate-config.xml.tpl" 
     tofile="${src.dir}/hibernate-config.xml"> 
    <filterchain> 
      <replacetokens> 
       <token key="@@[email protected]@" 
         value="${databasePassword}"/> 
      </replacetokens> 
    </filterchain> 
</copy> 
関連する問題