Skip to content

Commit

Permalink
ExplicitPluginGroupId should only add groupId if artifactId is present
Browse files Browse the repository at this point in the history
Fixes #4875
  • Loading branch information
timtebeek committed Jan 9, 2025
1 parent 0826417 commit d11eae9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public TreeVisitor<?, ExecutionContext> getVisitor() {
@Override
public Xml visitTag(Xml.Tag tag, ExecutionContext ctx) {
Xml.Tag t = (Xml.Tag) super.visitTag(tag, ctx);
if (isPluginTag() && !t.getChild("groupId").isPresent()) {
if (isPluginTag() && !t.getChild("groupId").isPresent() && t.getChild("artifactId").isPresent()) {
Xml.Tag groupIdTag = Xml.Tag.build("<groupId>org.apache.maven.plugins</groupId>");
t = (Xml.Tag) new AddToTagVisitor<>(t, groupIdTag, new MavenTagInsertionComparator(t.getChildren()))
.visitNonNull(t, ctx, getCursor().getParentOrThrow());
Expand Down

0 comments on commit d11eae9

Please sign in to comment.