Class Dependency

java.lang.Object
org.apache.maven.model.v3_0_0.Dependency
All Implemented Interfaces:
Serializable

public class Dependency extends Object implements Serializable
The <dependency> element contains information about a dependency of the project.
Version:
$Revision$ $Date$
See Also:
  • Field Details

    • id

      private String id
      Deprecated. Please use groupId and artifactId together instead.
    • groupId

      private String groupId
      The project group that produced the dependency, e.g. org.apache.maven.
    • artifactId

      private String artifactId
      The unique id for an artifact produced by the project group, e.g. maven-artifact.
    • version

      private String version
      The version of the dependency, e.g. 3.2.1. In Maven 2, this can also be specified as a range of versions.
    • url

      private String url
      This url will be provided to the user if the jar file cannot be downloaded from the central repository.
    • jar

      private String jar
      Literal name of the artifact in the repository. Used to override the calculated artifact name.
    • type

      private String type
      The type of dependency. This defaults to jar. While it usually represents the extension on the filename of the dependency, that is not always the case. Some examples are jar, war, and plugin. A dependency of type plugin is loaded as a Maven plugin and not added to the project build classpath.
    • properties

      private Properties properties
      Field properties.
  • Constructor Details

    • Dependency

      public Dependency()
  • Method Details

    • addProperty

      public void addProperty(String key, String value)
      Method addProperty.
      Parameters:
      key -
      value -
    • getArtifactId

      public String getArtifactId()
      Get the unique id for an artifact produced by the project group, e.g. maven-artifact.
      Returns:
      String
    • getGroupId

      public String getGroupId()
      Get the project group that produced the dependency, e.g. org.apache.maven.
      Returns:
      String
    • getId

      public String getId()
      Get Deprecated. Please use groupId and artifactId together instead.
      Returns:
      String
    • getJar

      public String getJar()
      Get literal name of the artifact in the repository. Used to override the calculated artifact name.
      Returns:
      String
    • getProperties

      public Properties getProperties()
      Method getProperties.
      Returns:
      Properties
    • getType

      public String getType()
      Get the type of dependency. This defaults to jar. While it usually represents the extension on the filename of the dependency, that is not always the case. Some examples are jar, war, and plugin. A dependency of type plugin is loaded as a Maven plugin and not added to the project build classpath.
      Returns:
      String
    • getUrl

      public String getUrl()
      Get this url will be provided to the user if the jar file cannot be downloaded from the central repository.
      Returns:
      String
    • getVersion

      public String getVersion()
      Get the version of the dependency, e.g. 3.2.1. In Maven 2, this can also be specified as a range of versions.
      Returns:
      String
    • setArtifactId

      public void setArtifactId(String artifactId)
      Set the unique id for an artifact produced by the project group, e.g. maven-artifact.
      Parameters:
      artifactId -
    • setGroupId

      public void setGroupId(String groupId)
      Set the project group that produced the dependency, e.g. org.apache.maven.
      Parameters:
      groupId -
    • setId

      public void setId(String id)
      Set Deprecated. Please use groupId and artifactId together instead.
      Parameters:
      id -
    • setJar

      public void setJar(String jar)
      Set literal name of the artifact in the repository. Used to override the calculated artifact name.
      Parameters:
      jar -
    • setProperties

      public void setProperties(Properties properties)
      Set properties about the dependency. Various plugins allow you to mark dependencies with properties. For example the war plugin looks for a war.bundle property, and if found will include the dependency in WEB-INF/lib.
      Parameters:
      properties -
    • setType

      public void setType(String type)
      Set the type of dependency. This defaults to jar. While it usually represents the extension on the filename of the dependency, that is not always the case. Some examples are jar, war, and plugin. A dependency of type plugin is loaded as a Maven plugin and not added to the project build classpath.
      Parameters:
      type -
    • setUrl

      public void setUrl(String url)
      Set this url will be provided to the user if the jar file cannot be downloaded from the central repository.
      Parameters:
      url -
    • setVersion

      public void setVersion(String version)
      Set the version of the dependency, e.g. 3.2.1. In Maven 2, this can also be specified as a range of versions.
      Parameters:
      version -
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • getKey

      public String getKey()
      Returns:
      the key as id:type
    • getArtifactDirectory

      public String getArtifactDirectory()
      Returns:
      the groupId as artifact directory
    • getArtifact

      public String getArtifact()
      Returns:
      the artifact name as artifactId-version.extension if <jar/> not set
    • getTypeDirectory

      public String getTypeDirectory()
    • getExtension

      public String getExtension()
    • isAddedToClasspath

      public boolean isAddedToClasspath()
    • isPlugin

      public boolean isPlugin()
    • getProperty

      public String getProperty(String property)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also: