Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven profiles with variable for properties

I am studying MAVEN profiles and i have a question about seting properties with variables. At the moment, i am using the following configuration :

<profile>
  <id>Action type D restriction</id>
  <activation>
    <property>
      <name>actionType</name>
      <value>D</value>
    </property>
  </activation>
  <properties>
    <restriction.actionType>D</restriction.actionType>
  </properties>
</profile>

<profile>
  <id>Action type W restriction</id>
  <activation>
    <property>
      <name>actionType</name>
      <value>W</value>
    </property>
  </activation>
  <properties>
    <restriction.actionType>W</restriction.actionType>
  </properties>
</profile>

My question is this ; is it possible to somehow use one profile with a variable to do the same job, something along the lines of :

<profile>
  <id>Action type restriction</id>
  <activation>
    <property>
      <name>actionType</name>
      <value>[D,W]</value>
    </property>
  </activation>
  <properties>
    <restriction.actionType>${project.profiles.profile.activation.value}</restriction.actionType>
  </properties>
</profile>

Or something along those lines.

like image 708
Lazaruss Avatar asked Nov 20 '25 11:11

Lazaruss


1 Answers

Maybe you want something like this

<profiles>
    <profile>
        <id>Action type restriction</id>
        <activation>
            <property>
                <name>actionType</name>
            </property>
        </activation>
        <properties>
            <restriction.actionType>${actionType}</restriction.actionType>
        </properties>
    </profile>
</profiles>
like image 95
michaldo Avatar answered Nov 25 '25 00:11

michaldo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!