1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.execution;
20
21 import org.apache.maven.artifact.versioning.ArtifactVersion;
22 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
23 import org.codehaus.plexus.component.annotations.Component;
24 import org.codehaus.plexus.component.annotations.Requirement;
25 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
26 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
27 import org.codehaus.plexus.util.StringUtils;
28
29
30
31
32
33
34 @Deprecated
35 @Component(role = RuntimeInformation.class)
36 public class DefaultRuntimeInformation implements RuntimeInformation, Initializable {
37
38 @Requirement
39 private org.apache.maven.rtinfo.RuntimeInformation rtInfo;
40
41 private ArtifactVersion applicationVersion;
42
43 public ArtifactVersion getApplicationVersion() {
44 return applicationVersion;
45 }
46
47 public void initialize() throws InitializationException {
48 String mavenVersion = rtInfo.getMavenVersion();
49
50 if (StringUtils.isEmpty(mavenVersion)) {
51 throw new InitializationException("Unable to read Maven version from maven-core");
52 }
53
54 applicationVersion = new DefaultArtifactVersion(mavenVersion);
55 }
56 }