ねもいのでとりあえずなぐりがき。休みにでもでちゃんと書く...はず(汗
http://www.area51.gr.jp/~rin/diary/?date=20090209#p04
http://d.hatena.ne.jp/kennak/20090209/1234146408
どうやら僕の認識が間違ってた模様ですね。
とりあえず同じ指向だと思います。
で、たぶんうちのプロジェクトではこんな感じだったと思われ...
と、記憶をもとにとりあえず試してみた。なんかいろいろ汚いけどゆるしてっ!
config/以下に各環境用設定値の入ったファイルを置いてビルド時には環境名を指定してやるってことで。
>find ./ . ./build.xml ./config ./config/seed.youichi ./out ./property.xml > cat ./config/seed.youichi _namae=youichi > ./cat property.xml <?xml version="1.0" encoding="Shift_JIS"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="test" class="jp.hoge.page.fuga"> <property name="foo"> <map> <entity key="NAMAE"><value>@NAMAE@</value></entity> </map> <property> </bean> </beans> > cat ./build.xml <?xml version="1.0" encoding="Shift_JIS"?> <project name="test4property"> <property name="_conf" value = "./config" /> <property name="_confFile" value = "seed.${person}" /> <property name="_todir" value="./out" /> <property name="_propertyfile" value="./property.xml" /> <property file="${_conf}/${_confFile}" /> <target name="create"> <echo level="info" message="person : ${person} " /> <echo level="info" message="confFile : ${_conf}/${_confFile}" /> <echo level="info" message="param _namae : ${_namae}" /> <echo level="info" message="copy file : ${_propertyfile}" /> <echo level="info" message="todir : ${_todir}" /> <copy file="${_propertyfile}" todir="${_todir}" overwrite="true"> <filterset> <filter token="NAMAE" value="${_namae}" /> </filterset> </copy> </target> </project> > ant create -Dperson=youichi Buildfile: build.xml create: [echo] person : youichi [echo] confFile : ./config/seed.youichi [echo] param _namae : youichi [echo] copy file : ./property.xml [echo] todir : ./out [copy] Copying 1 file to C:\cygwin\home\youichi\antTest\out BUILD SUCCESSFUL Total time: 0 seconds > find ./ . ./build.xml ./config ./config/seed.youichi ./out ./out/property.xml ./property.xml > cat ./out/property.xml <?xml version="1.0" encoding="Shift_JIS"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="test" class="jp.hoge.page.fuga"> <property name="foo"> <map> <entity key="NAMAE"><value>youichi</value></entity> </map> <property> </bean> </beans>