2014-09-01 31 views
0

我正在嘗試按照指導說明如何執行資源過濾。我有一個休眠屬性文件,現在有以下屬性;如何在maven中進行簡單的資源過濾?

<!-- db connection properties --> 
    <property name="hibernate.connection.url">${hibernate.connection.url}</property> 
    <property name="hibernate.connection.username">${hibernate.connection.username}</property> 
    <property name="hibernate.connection.password">${hibernate.connection.password}</property> 

和我的maven pom具有以下配置文件;

<profiles> 
    <profile> 
     <id>DEV</id> 
     <properties> 
      <hibernate.connection.url>devurl:port</hibernate.connection.url> 
      <hibernate.connection.username>user</hibernate.connection.username> 
      <hibernate.connection.password>password</hibernate.connection.password> 
     </properties> 
    </profile> 
    <profile> 
     <id>PROD</id> 
     <properties> 
      <hibernate.connection.url>produrl</hibernate.connection.url> 
      <hibernate.connection.username>user</hibernate.connection.username> 
      <hibernate.connection.password>pass</hibernate.connection.password> 
     </properties> 
    </profile> 
</profiles> 

我的maven在jenkins中構建url在變化之前看起來如下:

clean package org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true 

而且我也修改過這個外觀如下;

clean package -P DEV org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true 

它好像我也跟着指南等等的東西我在上面所做的必須是不正確的一切,因爲當我做了構建我收到錯誤,如java.lang.UnsupportedOperationException: The application must supply JDBC connections的質量。有人能夠看到我做錯了什麼嗎?

感謝

+0

你檢查的屬性在你的目標文件你所需的個人資料建立後pom.xml中在我的過濾器的XML文件?如果沒有,你可以發佈你的整個pom.xml嗎? – theadam 2014-09-01 10:12:39

+0

您是否找到了剛剛刪除的關於系統道具的問題的答案?我正在發佈答案 – 2014-09-01 12:00:09

+0

我沒有找到答案,不,我認爲我是愚蠢的,這是不可能的,因此恢復從命令行傳遞參數,而不是 - 是否可能thne – Biscuit128 2014-09-01 12:20:52

回答

0

我沒有列入

<resource> 
      <directory>resources</directory> 
      <filtering>true</filtering> 
      <includes> 
       <include>**/*.p12</include> 
       <include>**/*.properties</include> 
       <include>**/*.xml</include> 
      </includes> 
     </resource> 
相關問題