0
# Runtime Information
1
2
Runtime information and execution context compatibility for Maven2 patterns, providing version information and runtime details.
3
4
## Capabilities
5
6
### RuntimeInformation Interface
7
8
Main interface for accessing Maven runtime information.
9
10
```java { .api }
11
/**
12
* Provides runtime information about the Maven installation
13
* @deprecated Use org.apache.maven.rtinfo.RuntimeInformation instead
14
*/
15
@Deprecated
16
public interface RuntimeInformation {
17
/**
18
* Gets the version of the current Maven application
19
* @return ArtifactVersion representing the Maven version
20
*/
21
ArtifactVersion getApplicationVersion();
22
}
23
```
24
25
**Usage Example:**
26
27
```java
28
import org.apache.maven.execution.RuntimeInformation;
29
import org.apache.maven.execution.DefaultRuntimeInformation;
30
import org.apache.maven.artifact.versioning.ArtifactVersion;
31
32
// Create runtime information instance
33
RuntimeInformation runtimeInfo = new DefaultRuntimeInformation();
34
35
// Get Maven version
36
ArtifactVersion version = runtimeInfo.getApplicationVersion();
37
System.out.println("Maven version: " + version.toString());
38
```
39
40
### DefaultRuntimeInformation Implementation
41
42
Default implementation of the RuntimeInformation interface.
43
44
```java { .api }
45
/**
46
* Default implementation of RuntimeInformation
47
*/
48
public class DefaultRuntimeInformation implements RuntimeInformation {
49
/**
50
* Gets the version of the current Maven application
51
* @return ArtifactVersion representing the Maven version
52
*/
53
public ArtifactVersion getApplicationVersion();
54
}
55
```
56
57
## Migration Notes
58
59
This interface is deprecated and maintained only for backward compatibility. New code should use:
60
61
```java
62
// Instead of maven-compat RuntimeInformation
63
import org.apache.maven.rtinfo.RuntimeInformation;
64
65
// Modern approach
66
@Component
67
private RuntimeInformation runtimeInfo;
68
```
69
70
The legacy interface follows the Plexus component pattern used in Maven 2.x, while the modern Maven 3.x approach uses standard dependency injection patterns.