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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Eric Benzacar
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
Reply | Threaded
Open this post in threaded view
|

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

Hervé BOUTEMY
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: [hidden email]
For additional commands, e-mail: [hidden email]