You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Eric Benzacar <er...@benzacar.ca> on 2017/11/10 11:58:42 UTC

Any way to activate a profile based on a property substring?

Is there any way to use a substring of a property for profile activation in
Maven? I'm looking to use Jenkins to simply pass the branch name to my
build, and have a profile activated if it is a release/* branch.

Is there any way I can do parameter manipulation/regex like this for
profile activation? Ex:

  <profiles>
    <profile>
      <id>appserverConfig-dev</id>
      <activation>
        <property>
          <name>branch</name>

          <!-- some form of wildcarding or regex on the parameter value ??? -->
          <value>release/.*</value>
        </property>
      </activation>
      <properties>
        <appserver.home>/path/to/dev/appserver</appserver.home>
      </properties>
    </profile>
   </profiles>

Or is there a different/better approach that I can use to only activate the
profile if the build is coming from a release branch?


Thanks


Eric

Re: Any way to activate a profile based on a property substring?

Posted by Hervé BOUTEMY <he...@free.fr>.
the current PropertyProfileActivator [1] does not provide such feature

I imagine you can create an extension that will behave the way you want

Regards,

Hervé

[1] http://maven.apache.org/ref/3.5.2/maven-model-builder/xref/org/apache/
maven/model/profile/activation/PropertyProfileActivator.html

Le vendredi 10 novembre 2017, 12:58:42 CET Eric Benzacar a écrit :
> Is there any way to use a substring of a property for profile activation in
> Maven? I'm looking to use Jenkins to simply pass the branch name to my
> build, and have a profile activated if it is a release/* branch.
> 
> Is there any way I can do parameter manipulation/regex like this for
> profile activation? Ex:
> 
>   <profiles>
>     <profile>
>       <id>appserverConfig-dev</id>
>       <activation>
>         <property>
>           <name>branch</name>
> 
>           <!-- some form of wildcarding or regex on the parameter value ???
> --> <value>release/.*</value>
>         </property>
>       </activation>
>       <properties>
>         <appserver.home>/path/to/dev/appserver</appserver.home>
>       </properties>
>     </profile>
>    </profiles>
> 
> Or is there a different/better approach that I can use to only activate the
> profile if the build is coming from a release branch?
> 
> 
> Thanks
> 
> 
> Eric



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org