Package org.apache.maven.rtinfo.internal
Class DefaultRuntimeInformation
- java.lang.Object
-
- org.apache.maven.rtinfo.internal.DefaultRuntimeInformation
-
- All Implemented Interfaces:
RuntimeInformation
@Component(role=RuntimeInformation.class) public class DefaultRuntimeInformation extends java.lang.Object implements RuntimeInformation
Provides information about the current Maven runtime.
-
-
Field Summary
Fields Modifier and Type Field Description private org.codehaus.plexus.logging.Loggerloggerprivate java.lang.StringmavenVersionprivate static java.lang.StringVERSION_RANGE_ERROR_MESSAGE
-
Constructor Summary
Constructors Constructor Description DefaultRuntimeInformation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetMavenVersion()Retrieves the current Maven version, for example "3.0.2".booleanisMavenVersion(java.lang.String versionRange)Checks whether the current Maven runtime matches the specified version range.
-
-
-
Field Detail
-
logger
@Requirement private org.codehaus.plexus.logging.Logger logger
-
mavenVersion
private java.lang.String mavenVersion
-
VERSION_RANGE_ERROR_MESSAGE
private static final java.lang.String VERSION_RANGE_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMavenVersion
public java.lang.String getMavenVersion()
Description copied from interface:RuntimeInformationRetrieves the current Maven version, for example "3.0.2".- Specified by:
getMavenVersionin interfaceRuntimeInformation- Returns:
- The current Maven version or an empty string if unknown, never
null.
-
isMavenVersion
public boolean isMavenVersion(java.lang.String versionRange)
Description copied from interface:RuntimeInformationChecks whether the current Maven runtime matches the specified version range. A version range can either use the usual mathematical syntax "[2.0.10,2.1.0),[3.0,)" or use a single version "2.2.1". The latter is a short form for "[2.2.1,)", i.e. denotes the minimum version required.- Specified by:
isMavenVersionin interfaceRuntimeInformation- Parameters:
versionRange- The version range to match the current Maven runtime against, must not benull.- Returns:
trueif the current Maven runtime matches the specified version range,falseotherwise.
-
-