Class Dependency

java.lang.Object
io.spring.initializr.generator.buildsystem.Dependency
Direct Known Subclasses:
GradleDependency, MavenDependency

public class Dependency extends Object
A dependency to be declared in a project's build configuration.
Author:
Andy Wilkinson, Stephane Nicoll
  • Constructor Details

  • Method Details

    • withCoordinates

      public static Dependency.Builder<?> withCoordinates(String groupId, String artifactId)
      Initialize a new dependency Dependency.Builder with the specified coordinates.
      Parameters:
      groupId - the group ID of the dependency
      artifactId - the artifact ID of the dependency
      Returns:
      a new builder
    • from

      public static Dependency.Builder<?> from(Dependency dependency)
      Initialize a new dependency Dependency.Builder with the state of the specified Dependency.
      Parameters:
      dependency - the dependency to use to initialize the builder
      Returns:
      a new builder initialized with the same state as the dependency
    • getGroupId

      public String getGroupId()
      The group ID of the dependency.
      Returns:
      the group ID
    • getArtifactId

      public String getArtifactId()
      The artifact ID of the dependency.
      Returns:
      the artifact ID
    • getVersion

      public VersionReference getVersion()
      The VersionReference of the dependency. May be null for a dependency whose version is expected to be provided by dependency management.
      Returns:
      the version reference or null
    • getScope

      public DependencyScope getScope()
      The scope of the dependency.
      Returns:
      the scope
    • getClassifier

      public String getClassifier()
      The classifier of this dependency. Can be null
      Returns:
      the classifier or null
    • getType

      public String getType()
      The type of the dependency. Can be null to indicate that the default type should be used (i.e. jar).
      Returns:
      the type or null
    • getExclusions

      public Set<Dependency.Exclusion> getExclusions()
      The exclusions to apply.
      Returns:
      the exclusions to apply