Class DependencyNotation

java.lang.Object
org.openrewrite.maven.tree.DependencyNotation

public class DependencyNotation extends Object
Utility class for parsing and formatting Gradle-style dependency notation strings. This class is separate from Dependency to avoid classloading issues in parent-loaded contexts.
  • Method Details

    • parse

      public static @Nullable Dependency parse(@Nullable String notation)
      Parses a Gradle-style dependency string notation into a Dependency object.

      Format: "group:artifact:version:classifier@extension"

      All parts are optional except the artifact name. The minimum valid notation is ":artifact".

      Parameters:
      notation - a String in the format group:artifact:version:classifier@extension
      Returns:
      A corresponding Dependency or null if the notation could not be parsed
    • toStringNotation

      public static String toStringNotation(Dependency dependency)
      Returns a Gradle-style string notation for the given dependency.

      Format: "group:name:version:classifier@extension"

      All parts are optional except the artifact name.

      Parameters:
      dependency - the dependency to convert to string notation
      Returns:
      the dependency in Gradle string notation