Skip to content

Commit

Permalink
Fix Maven plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Simon committed Sep 27, 2024
1 parent 6b2a8d2 commit 04bbb45
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/cfgnet/plugins/concept/maven_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,18 @@ def parse_tree(self, subtree_root: _Element, parent_node: Node):
option = OptionNode(name, subtree_root.sourceline, config_type)
parent_node.add_child(option)

value_name = subtree_root.text.strip()

if value_name:
value_node = ValueNode(name=value_name)
option.add_child(value_node)
else:
for child in subtree_root:
if child.tag is not ET.Comment:
self.parse_tree(child, option)

# remove option nodes without children
text = subtree_root.text
if text:
text = text.strip()
if text:
value_node = ValueNode(name=text)
option.add_child(value_node)

for child in subtree_root:
if child.tag is not ET.Comment:
self.parse_tree(child, option)

# remove option nodes without children
if not option.children:
parent_node.children.remove(option)

Expand Down
4 changes: 4 additions & 0 deletions tests/files/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<version>42</version>
<packaging>jar</packaging>

<parent>
<relativePath/>
</parent>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down

0 comments on commit 04bbb45

Please sign in to comment.