Custom profile activators allow you to write your own implementation of <tt>org.apache.maven.profiles.activation.ProfileActivator</tt>, import it into a project as a build extension, and use it to activate profiles in your build.
We can declare the profile that uses our new custom activator in the parent POM, along with the extension containing its implementation:
Then, to activate the <tt>versionless-archive</tt> profile in our child POM, we add the specified POM property, like this:
This makes it a simple task to customize your projects by using profiles as mix-ins. These profiles can be maintained at a single point, in the parent POM.
Finally, the custom profile activator might look like this:
- The Java source code above relies on the new Build Context feature of Maven 2.1. This feature allows components in the Maven runtime - including mojos - to import and export shared, structured information. It's important to note that this feature is not yet completely stabilized; therefore, the code above will be changing in the future, in response to changes in the Build Context.