2013-04-19 26 views
6

pom.xmlにmavenプロパティを設定しました。Antタスクを使用してmavenプロパティを変更する

<properties> 
    <build.start.date>someValue</build.start.date> 
</properties> 

今、私は次のことをやってAntタスクを持っている:

<loadresource property="build.start"> 
    <url url="http://someUrl?xpath=/*/id/text()"/> 
</loadresource> 

<property name="build.start.date" value="${build.start}"/> 

<echo>Printing Ant Value ${build.start} </echo> 
<echo>Printing Maven Value ${build.start.date}</echo> 

これは、その結果:

[echo] Printing Ant Value 2013-03-15_17-53-08 
[echo] Printing Maven Value 2013-03-16 

しかし、私は印刷の両方を期待しています:

[echo] Printing Ant Value 2013-03-15_17-53-08 
[echo] Printing Maven Value 2013-03-15_17-53-08 


I tried <loadresource property="build.start.date"> 
and 
I tried <loadresource property="${build.start.date}"> 

ですから、どうすればグローバルなアリタスクの中のmavenプロパティ?

+0

:あなたはexportAntPropertiesに真(デフォルトはfalse)を持っている必要があります設定の下で続いて

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> .... </plugin> 

を私はあなたがあなたのantスクリプトをmaven-antrun-pluginで実行していると仮定します。あなたがmavenから来る価値を無効にしたいのではないでしょうか? Antのプロパティは一度設定された後、決して上書きすることはできません。 – adrianboimvaser

+0

antのプロパティではないので、antrunプラグインの内部でmavenのプロパティをリセットする必要があります。 – avijendr

+0

''はすでに設定されているプロパティをオーバーライドしようとします。プロパティはMavenによって設定されました。 – adrianboimvaser

答えて

12

この解決策が見つかりました。

あなたがantrunプラグインの1.7バージョン持っている必要がありますまず第一に:

<configuration> 
<exportAntProperties>true</exportAntProperties> 
関連する問題