[英]How should I configure the eclipse to make use of different values of environment variable for different maven phases, during maven building process?
史前史
我們的項目使用 maven 構建。 我們使用 eclipse。
在項目中我有兩個數據庫屬性文件:
具有相同的結構:
jdbc.driverClassName=
jdbc.url=
jdbc.username=
jdbc.password=
文件中用戶名和密碼的值不同。 所以我們對睾丸和生產使用不同的方案。
在 data-access-config.xml 我有以下行:
<context:property-placeholder location="classpath:jdbc.${db.flag}.properties"/>
我所做的:
我想要的是:
現在我使用bat文件:
call mvn test -Ddb.flag=test
call mvn install -Ddb.flag=prod -Dmaven.test.skip=true
但這對我的團隊來說不是問題。
在 maven 構建過程中,我應該如何配置 eclipse 以針對不同的 maven 階段使用不同的環境變量值?
我很樂意接受任何建議。
我建議在 src/main/resources 和 src/test/resources 中將每個副本保持在相同的名稱(jdbc.properties)下,這樣測試階段可以自動獲取您的“測試”設置,並且不再需要您的位置屬性。
Maven 將確保測試資源僅在測試階段使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.