Maven properties at plugin execution time

Viewed 2674

I am trying to figure out how to set a maven property to a different value at different points in the lifecycle. For example, if I set a property at the project level

<project>
    <properties>
        <some.property>Value</some.property>
    </properties>
</project>

During a third-party plugins execution I would like to be able to change it to something else.

<plugins>
    <plugin>
        <groupId>com.github.mcheely</groupId>
        <artifactId>requirejs-maven-plugin</artifactId>
        <version>2.0.0</version>
        <executions>
           <execution>
                <!-- change the value here -->
           </execution>
           <execution>
                <!-- change the value here again-->
           </execution>
        </executions>
    </plugin>
</plugins>

Or alternatively, rather than go the variable setting route, It would work just as well if I could access a unique ID or property set inside the particular execution. For example-

<plugins>
    <plugin>
        <groupId>com.github.mcheely</groupId>
        <artifactId>requirejs-maven-plugin</artifactId>
        <version>2.0.0</version>
        <executions>
           <execution>
               <id>SomeID</id>
               <!-- change the value here -->
           </execution>
           <execution>
               <id>SomeID</id>
               <!-- change the value here again-->
           </execution>
        </executions>
    </plugin>
</plugins>

and then access this variable like so

${execution.id}

Any ideas?

1 Answers
Related