Example With Harvest and Expand In Profiles

Profile-wrapped configuration for expanding and harvesting a project.

<?xml version="1.0" encoding="UTF-8"?>
<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">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.normalizedsystems</groupId>
  <artifactId>my-project-expansion</artifactId>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <expanders-maven-plugin.version>2022.5.3-SNAPSHOT</expanders-maven-plugin.version>
  </properties>

  <profiles>
    <profile>
      <id>harvest</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>net.democritus.maven.plugins</groupId>
            <artifactId>expanders-maven-plugin</artifactId>
            <version>${expanders-maven-plugin.version}</version>
            <executions>
              <execution>
                <id>harvest</id>
                <goals>
                  <goal>harvest</goal>
                </goals>
                <phase>generate-sources</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>expand</id>
      <build>
        <plugins>
          <plugin>
            <groupId>net.democritus.maven.plugins</groupId>
            <artifactId>expanders-maven-plugin</artifactId>
            <version>${expanders-maven-plugin.version}</version>
            <executions>
              <execution>
                <id>expand</id>
                <goals>
                  <goal>expand</goal>
                </goals>
                <phase>initialize</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>