2014-09-01 34 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> 
相关问题