|
42 | 42 |
|
43 | 43 | import javax.xml.parsers.ParserConfigurationException; |
44 | 44 |
|
| 45 | +import org.scijava.Versioned; |
45 | 46 | import org.xml.sax.SAXException; |
46 | 47 |
|
47 | 48 | /** |
48 | 49 | * Helper class for working with Maven POMs. |
49 | 50 | * |
50 | 51 | * @author Curtis Rueden |
51 | 52 | */ |
52 | | -public class POM extends XML implements Comparable<POM> { |
| 53 | +public class POM extends XML implements Comparable<POM>, Versioned { |
53 | 54 |
|
54 | 55 | /** Parses a POM from the given file. */ |
55 | 56 | public POM(final File file) throws ParserConfigurationException, |
@@ -93,13 +94,6 @@ public String getArtifactId() { |
93 | 94 | return cdata("//project/artifactId"); |
94 | 95 | } |
95 | 96 |
|
96 | | - /** Gets the POM's version. */ |
97 | | - public String getVersion() { |
98 | | - final String version = cdata("//project/version"); |
99 | | - if (version != null) return version; |
100 | | - return cdata("//project/parent/version"); |
101 | | - } |
102 | | - |
103 | 97 | /** Gets the project name. */ |
104 | 98 | public String getProjectName() { |
105 | 99 | return cdata("//project/name"); |
@@ -146,6 +140,16 @@ public int compareTo(final POM pom) { |
146 | 140 | return compareVersions(getVersion(), pom.getVersion()); |
147 | 141 | } |
148 | 142 |
|
| 143 | + // -- Versioned methods -- |
| 144 | + |
| 145 | + /** Gets the POM's version. */ |
| 146 | + @Override |
| 147 | + public String getVersion() { |
| 148 | + final String version = cdata("//project/version"); |
| 149 | + if (version != null) return version; |
| 150 | + return cdata("//project/parent/version"); |
| 151 | + } |
| 152 | + |
149 | 153 | // -- Utility methods -- |
150 | 154 |
|
151 | 155 | /** |
|
0 commit comments