Monday, October 01, 2012

Accessing Maven Profiles

I have just spent some time trying to figure out how to determine which profiles are active  during the build using Maven. This functionality would be useful if you needed to put your profile activation in JAR MANIFEST file if your project supported various versions of dependency files (for example different servers, portals or Ajax libraries ...) and in case that your version information did not include this.

Here is a snippet that will make you life easier using GMaven plugin:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
                                project.parent.activeProfiles.each() { item->'activatedProfiles', + "${} ")}

If you know easier way, please let me know.