[
https://issues.apache.org/jira/browse/MNG-4777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15063605#comment-15063605
]
Ville commented on MNG-4777:
----------------------------
I have a patch I would like to submit for this issue (see attached).
Unfortunately, I am unable to re-open this issue; [~jvanzyl] please let me know
if you would prefer that I file a new issue.
Our use case is to activate a profile when the project version is (or is not) a
SNAPSHOT version. In order to do this, we create a project property for the
version, then a inactive-by-default profile with a property activation rule.
The property value of the rule may be set to either: "~.*-SNAPSHOT" (is a
SNAPSHOT version) or "!~.*-SNAPSHOT" (is not a SNAPSHOT version).
The patch includes the following changes:
- Fetching the property value from project properties if it is not found in
either user properties or system properties.
- Supporting a prefix character "~" for a regular expression comparison (as
suggested by [[email protected]] above).
Negation is extended to regular expressions if "!" is specified before "~". The
patch includes unit tests and the integration tests pass with "mvn -Prun-its
install" from the root of the project tree. I would be happy to submit a
documentation patch as well; however, I have been unable to locate the
documentation source to modify around profile activation using properties. The
closest I have come is the Maven Book on Sonatype here:
https://books.sonatype.com/mvnref-book/reference/resource-filtering-sect-properties.html
> Match property for profile activation against a regex
> -----------------------------------------------------
>
> Key: MNG-4777
> URL: https://issues.apache.org/jira/browse/MNG-4777
> Project: Maven
> Issue Type: Improvement
> Components: Profiles
> Affects Versions: 2.0.11
> Reporter: Andreas Ebbert-Karroum
>
> For activating a profile it would be nice, in addition or as a seperate
> feature to MNG-3328, to match a property not against a specific value but
> against a regex. In our case, we need to set some properties for some hudson
> builds. Not only is that setup fragile against job name changes, but also
> doesn't scale for multiple jobs. IMHO adding a regex matcher would be a nice
> feature for multiple purposes.
> Old:
> {code:xml}
> <activation>
> <property>
> <name>env.JOB_NAME</name>
>
> <value>xyz-abc-foo/label=robotframework,maven.browser-profile=firefox,maven.env-profile=dev</value>
> </property>
> </activation>
> {code}
> New:
> {code:xml}
> <activation>
> <property>
> <name>env.JOB_NAME</name>
> <regex>xyz-abc-foo/.*</regex>
> </property>
> </activation>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)