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