Maven activates property value and version

there is a way to activate profile by property, but instead of checking specific validation of the value for the version range here is what i am trying to do

<properties>
  <frontend-maven-plugin.version>0.0.16</frontend-maven-plugin.version>
</properties>
...
...
<profile>
  <id>new_version_of_frontend</id>
  <activation>
    <property>
      <name>maven.version</name>
      <value>3.1.0</value>
    </property>
    <properties>
      <frontend-maven-plugin.version>0.0.23</frontend-maven-plugin.version>
    </properties>
  </activation>
</profile>

      

so the above works (set the frontend plugin version to 0.0.23 when maven version is 3.1.0

what I would like to do is change the condition to 3.1.0 and above something like

<value>[3.1.0,)</value>

      

but property value validation does not support version range. is there any other way to do this? or even check version 3.1+

+3


source to share


1 answer


I believe there is no such functionality with out of the box Maven. Maven is usually very simple looking at its internals. The property based profile activation basically consists of two equality strings, nothing more, no extra logic here.



I can imagine a solution that introduces a simple native Maven plugin that executes the real range engine and sets a property like frontend-maven-plugin.version.within.range

, value true

or false

. Then the profile activation condition is based on the value of true

this property. This can work if you get your plugin up and running early enough, possibly in a initialize

lifecycle phase . I am not sure, however, if the activation of the profiles is even earlier or not. You need to check it out.

+1


source







All Articles