title: Maven Resource Filtering with Spring Boot: Could not resolve placeholder
body: <p>Kind of new to Java and Maven, but I trying to get Maven to handle the database connection properties so I can have the maven build change them between dev/stage/prod environments and I am running into issues with filtering and resources. Not sure what I am doing wrong here either.</p>
  
  <p>POM File:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;com.comapny&lt;/groupId&gt;
  &lt;artifactId&gt;reporting&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;reporting&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
  &lt;properties&gt;
      &lt;db.jdbcUrl&gt;jdbc:aURL&lt;/db.jdbcUrl&gt;
      &lt;db.jdbcUn&gt;aUser&lt;/db.jdbcUn&gt;
      &lt;db.jdbcPw&gt;aPassword&lt;/db.jdbcPw&gt;
  
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;springframework.version&gt;4.2.3.RELEASE&lt;/springframework.version&gt;
      &lt;springframework.jdbc.version&gt;4.1.4.RELEASE&lt;/springframework.jdbc.version&gt;
      &lt;hadoop.version&gt;2.7.1.2.3.4.2-1&lt;/hadoop.version&gt;
      &lt;hbase.version&gt;1.1.2.2.3.4.2-1&lt;/hbase.version&gt;
      &lt;phoenix.version&gt;4.4.0.2.3.4.2-1&lt;/phoenix.version&gt;
      &lt;junit.version&gt;4.12&lt;/junit.version&gt;
      &lt;mail.version&gt;1.4.3&lt;/mail.version&gt;
  &lt;/properties&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.3.0.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;github-releases&lt;/id&gt;
          &lt;url&gt;http://oss.sonatype.org/content/repositories/github-releases/&lt;/url&gt;
      &lt;/repository&gt;
      &lt;repository&gt;
          &lt;id&gt;clojars.org&lt;/id&gt;
          &lt;url&gt;http://clojars.org/repo&lt;/url&gt;
      &lt;/repository&gt;
      &lt;repository&gt;
          &lt;id&gt;hortonworks&lt;/id&gt;
          &lt;url&gt;http://repo.hortonworks.com/content/repositories/releases/&lt;/url&gt;
      &lt;/repository&gt;
      &lt;repository&gt;
          &lt;id&gt;twitter4j&lt;/id&gt;
          &lt;url&gt;http://twitter4j.org/maven2&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  
  &lt;dependencies&gt;
  
      &lt;!-- &lt;dependency&gt; &lt;groupId&gt;jdk.tools&lt;/groupId&gt; &lt;artifactId&gt;jdk.tools&lt;/artifactId&gt; 
          &lt;version&gt;1.7.0_05&lt;/version&gt; &lt;scope&gt;system&lt;/scope&gt; &lt;systemPath&gt;${JAVA_HOME}/lib/tools.jar&lt;/systemPath&gt; 
          &lt;/dependency&gt; --&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;!-- &lt;version&gt;1.2.3.RELEASE&lt;/version&gt; --&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;xerces&lt;/groupId&gt;
          &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
          &lt;version&gt;2.9.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;xalan&lt;/groupId&gt;
          &lt;artifactId&gt;xalan&lt;/artifactId&gt;
          &lt;version&gt;2.7.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;jdk.tools&lt;/groupId&gt;
          &lt;artifactId&gt;jdk.tools&lt;/artifactId&gt;
          &lt;version&gt;1.7.0_05&lt;/version&gt;
          &lt;scope&gt;system&lt;/scope&gt;
          &lt;systemPath&gt;${JAVA_HOME}/lib/tools.jar&lt;/systemPath&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.phoenix&lt;/groupId&gt;
          &lt;artifactId&gt;phoenix-core&lt;/artifactId&gt;
          &lt;version&gt;${phoenix.version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-over-slf4j&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;!-- &lt;exclusion&gt; &lt;artifactId&gt;joda-time&lt;/artifactId&gt; &lt;groupId&gt;joda-time&lt;/groupId&gt; 
                  &lt;/exclusion&gt; --&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
          &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Hadoop Dependencies --&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-util&lt;/artifactId&gt;
          &lt;version&gt;6.1.26&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-sslengine&lt;/artifactId&gt;
          &lt;version&gt;6.1.26&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt;
          &lt;artifactId&gt;hadoop-client&lt;/artifactId&gt;
          &lt;version&gt;${hadoop.version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  
      &lt;!-- HBase Dependcies --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.hbase&lt;/groupId&gt;
          &lt;artifactId&gt;hbase-client&lt;/artifactId&gt;
          &lt;version&gt;${hbase.version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-over-slf4j&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- Other --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
          &lt;artifactId&gt;mailapi&lt;/artifactId&gt;
          &lt;version&gt;${mail.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
          &lt;artifactId&gt;mail&lt;/artifactId&gt;
          &lt;version&gt;${mail.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
          &lt;version&gt;1.9.13&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- End of Other --&gt;
  
      &lt;!-- Log4J 2.x 2.4.1 --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.github.omkreddy&lt;/groupId&gt;
          &lt;artifactId&gt;log4j2-kafka-appender&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
          &lt;artifactId&gt;kafka-clients&lt;/artifactId&gt;
          &lt;version&gt;0.9.0.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Test --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;build&gt;
  
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.7&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;encoding&gt;UTF-8&lt;/encoding&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.5.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
                  &lt;showWarnings&gt;false&lt;/showWarnings&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/resources&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;includes&gt;
                  &lt;include&gt;db.properties&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
  
      &lt;testResources&gt;
          &lt;testResource&gt;
              &lt;directory&gt;src/test/resources&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;includes&gt;
                  &lt;include&gt;db.properties&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/testResource&gt;
      &lt;/testResources&gt;
  
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>db.properties</p>
  
  <pre><code>jdbc.url= ${db.jdbcUrl}
  jdbc.username= ${db.jdbcUn}
  jdbc.password= ${db.jdbcPw}
  </code></pre>
  
  <p>Maven version 3.3.8</p>
  
  <p>JDK 1.8.0-72</p>
  
  <p>Command Line</p>
  
  <pre><code>mvn test -P development -X
  </code></pre>
  
  <p>Error</p>
  
  <pre><code> java.lang.IllegalArgumentException: Could not resolve placeholder 'db.jdbcUrl' in string value "${db.jdbcUrl}"
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>