Skip to content

Commit 788fc15

Browse files
committed
java: resolve ${project.groupId} and ${project.artifactId} variables
1 parent 0550497 commit 788fc15

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

codemeta/parsers/java.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ def parse_java(g: Graph, res: Union[URIRef, BNode], file: IO , crosswalk, args:
133133
g.add((orgres, SDO.url, Literal(org_url)))
134134
g.add((res, SDO.producer, orgres))
135135
elif key.lower() in crosswalk[CWKey.MAVEN]:
136+
value = node.text
137+
if group_id and value.find("${project.groupId}") != -1:
138+
value = value.replace("${project.groupId}", group_id)
139+
if artifact_id and value.find("${project.artifactId}") != -1:
140+
value = value.replace("${project.artifactId}", artifact_id)
136141
key = crosswalk[CWKey.MAVEN][key.lower()]
137142
if key != 'identifier':
138-
add_triple(g, res, key, node.text, args)
143+
add_triple(g, res, key, value, args)
139144

140145
if group_id and artifact_id:
141146
add_triple(g, res, "identifier", group_id + "." + artifact_id, args)

0 commit comments

Comments
 (0)