1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.hazendaz.maven.makeself;
19
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.util.Properties;
23
24 import lombok.Getter;
25
26 import org.apache.maven.plugin.MojoFailureException;
27 import org.apache.maven.plugin.logging.Log;
28
29
30
31
32 public class PortableGit {
33
34
35 @Getter
36 private String groupId;
37
38
39 @Getter
40 private String artifactId;
41
42
43 @Getter
44 private String version;
45
46
47 @Getter
48 private String extension;
49
50
51 @Getter
52 private String classifier;
53
54
55 @Getter
56 private String name;
57
58
59
60
61
62
63
64
65
66
67 public PortableGit(final Log log) throws MojoFailureException {
68 try (InputStream input = this.getClass().getClassLoader().getResourceAsStream("META-INF/makeself.properties")) {
69 final Properties properties = new Properties();
70 properties.load(input);
71
72 this.groupId = properties.getProperty("portable.git.groupId");
73 this.artifactId = properties.getProperty("portable.git.artifactId");
74 this.version = properties.getProperty("portable.git.version");
75 this.extension = properties.getProperty("portable.git.extension");
76 this.classifier = properties.getProperty("portable.git.classifier");
77 this.name = properties.getProperty("portable.git.name");
78 } catch (final IOException e) {
79 log.error("Unable to read makeself.properties");
80 throw new MojoFailureException(e);
81 }
82 }
83
84 }