Skip to content

Commit 32cdb35

Browse files
committed
POM: add accessors for parent GAV info
1 parent 5e0bf6d commit 32cdb35

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/main/java/org/scijava/util/POM.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,26 @@ public POM(final String s) throws ParserConfigurationException, SAXException,
8484

8585
// -- POM methods --
8686

87+
/** Gets the POM's parent groupId. */
88+
public String getParentGroupId() {
89+
return cdata("//project/parent/groupId");
90+
}
91+
92+
/** Gets the POM's parent artifactId. */
93+
public String getParentArtifactId() {
94+
return cdata("//project/parent/artifactId");
95+
}
96+
97+
/** Gets the POM's parent artifactId. */
98+
public String getParentVersion() {
99+
return cdata("//project/parent/version");
100+
}
101+
87102
/** Gets the POM's groupId. */
88103
public String getGroupId() {
89104
final String groupId = cdata("//project/groupId");
90105
if (groupId != null) return groupId;
91-
return cdata("//project/parent/groupId");
106+
return getParentGroupId();
92107
}
93108

94109
/** Gets the POM's artifactId. */
@@ -191,7 +206,7 @@ public String getVersion() {
191206
synchronized (this) {
192207
if (version == null) {
193208
version = cdata("//project/version");
194-
if (version == null) version = cdata("//project/parent/version");
209+
if (version == null) version = getParentVersion();
195210
}
196211
}
197212
}

0 commit comments

Comments
 (0)