title: Access Spring profile specific application properties in POM
body: <p>I cannot find anything that explains how to access spring profile specific application properties inside of <code>pom.xml</code>. Is this possible? I find lots of info about doing the opposite (accessing Maven profile properties in the application) but nothing on this.</p>
  
  <p>My specific use case is being able to set the Tomcat manager URL in the Tomcat plugin from a properties file like this below. Please keep in mind that my question is only what is in the title and that I'm not asking for help configuring the Tomcat plugin so I will not include it in the question tags.</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.2&lt;/version&gt;
      &lt;configuration&gt;
          &lt;url&gt;${tomcat.manager.url}&lt;/url&gt;
          &lt;server&gt;${tomcat.server.name}&lt;/server&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>I have these profiles in my POM:</p>
  
  <pre><code>&lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;dev&lt;/id&gt;
          &lt;properties&gt;
              &lt;activatedProperties&gt;dev&lt;/activatedProperties&gt;
          &lt;/properties&gt;
          &lt;activation&gt;
              &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
          &lt;/activation&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;test&lt;/id&gt;
          &lt;properties&gt;
              &lt;activatedProperties&gt;test&lt;/activatedProperties&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p>And this in the same POM's build element:</p>
  
  <pre><code>&lt;resources&gt;
      &lt;resource&gt;
          &lt;directory&gt;src/main/resources&lt;/directory&gt;
          &lt;filtering&gt;true&lt;/filtering&gt;
      &lt;/resource&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>In my <code>application.properties</code>:</p>
  
  <pre><code># active profile placeholder for the active maven profile. Defaults to dev.
  spring.profiles.active=@activatedProperties@
  </code></pre>
  
  <p>and in my <code>application-test.properties</code>:</p>
  
  <pre><code>tomcat.manager.url=http://mydomain:8080/manager/text
  tomcat.server.name=myserver
  </code></pre>
  
  <p>but when I run_</p>
  
  <pre><code>mvn tomcat7:redeploy -DskipTests -P test
  </code></pre>
  
  <p>it does not try to deploy to <code>http://mydomain:8080/manager/text</code>, but uses the default of <code>localhost:8080</code>.</p>