Class MavenTagInsertionComparator

java.lang.Object
org.openrewrite.maven.MavenTagInsertionComparator
All Implemented Interfaces:
Comparator<org.openrewrite.xml.tree.Content>

public class MavenTagInsertionComparator extends Object implements Comparator<org.openrewrite.xml.tree.Content>
Helps to insert a new POM element in the most idiomatic place possible while preserving the existing order of the already present elements.

So we'll prefer to insert a dependencies block after GAV coordinates, SCM, properties, but before plugins. "After" ordering preference takes priority over "before".

  • Constructor Details

    • MavenTagInsertionComparator

      public MavenTagInsertionComparator(List<? extends org.openrewrite.xml.tree.Content> existingTags)
  • Method Details

    • compare

      public int compare(org.openrewrite.xml.tree.Content c1, org.openrewrite.xml.tree.Content c2)
      Specified by:
      compare in interface Comparator<org.openrewrite.xml.tree.Content>