title: Spring Boot: Automatic property expansion using Maven and specific Maven profiles is not working
body: <p>I'm trying to use the <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html#howto-automatic-expansion-maven" rel="nofollow noreferrer">72.1.1 Automatic property expansion using Maven</a> as specified in the documentation using different maven profiles, but <strong>I'm not able to make it work with specific profiles</strong>.</p>
  
  <p>I have the following <strong><code>pom.xml</code></strong>:</p>
  
  <pre><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;test&lt;/groupId&gt;
      &lt;artifactId&gt;test&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;local&lt;/id&gt;
  
              &lt;activation&gt;
                  &lt;property&gt;
                      &lt;name&gt;profileName&lt;/name&gt;
                      &lt;value&gt;local&lt;/value&gt;
                  &lt;/property&gt;
              &lt;/activation&gt;
              &lt;properties&gt;
                  &lt;wildcard.for.customproperty&gt;valueA&lt;/wildcard.for.customproperty&gt;
              &lt;/properties&gt;
          &lt;/profile&gt;
  
          &lt;profile&gt;
              &lt;id&gt;external&lt;/id&gt;
              &lt;activation&gt;
                  &lt;property&gt;
                      &lt;name&gt;profileName&lt;/name&gt;
                      &lt;value&gt;external&lt;/value&gt;
                  &lt;/property&gt;
              &lt;/activation&gt;
              &lt;properties&gt;
                  &lt;wildcard.for.customproperty&gt;valueB&lt;/wildcard.for.customproperty&gt;
              &lt;/properties&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
              &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &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;
          &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;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>And this very simple <strong><code>application.properties</code></strong>:</p>
  
  <pre><code>custom.property=@wildcard.for.customproperty@
  </code></pre>
  
  <p>I run the maven build with Spring Tool Suite with the following goals:</p>
  
  <pre><code>clean install -DprofileName=local
  </code></pre>
  
  <p>The build SUCCESS, but the <code>application.properties</code> in target folder still contains the unresolved <code>@...@</code> placeholder.</p>
  
  <p>If I add this simple line in the pom.xml in one of the two profiles:</p>
  
  <pre><code>&lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
  </code></pre>
  
  <p>The placeholder is correctly resolved.</p>
  
  <p>What's wrong with this configuration?</p>