Reputation: 1343
i found this question (Correct way to check Java version from BASH script). I am unsure how to do the same for Apache maven. I have to make sure for an installation script that at least version 3.1.1 of Maven is installed.
Upvotes: 0
Views: 72
Reputation: 97517
You need to do it that way, cause prerequisites is deprecated with Maven 3.
<!-- The following is marked as deprecated with Maven 3. so using maven-enforcer-plugin instead. -->
<!-- http://jira.codehaus.org/browse/MNG-4840 -->
<!-- http://jira.codehaus.org/browse/MNG-5297 -->
<prerequisites>
<maven>${mavenVersion}</maven>
</prerequisites>
(...)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>${mavenVersion}</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
Upvotes: 1
Reputation: 3584
Maven has a feature to declare minimum maven version in the POM itself. You don't need to add any other check after you add this to your POM:
<prerequisites>
<maven>3.1.1</maven>
</prerequisites>
See Prerequisites in maven documentation.
Upvotes: 0