Class Dependency

  • All Implemented Interfaces:
    java.io.Serializable

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

      Fields 
      Modifier and Type Field Description
      private java.lang.String artifactId
      The unique id for an artifact produced by the project group, e.g.
      private java.lang.String groupId
      The project group that produced the dependency, e.g.
      private java.lang.String id
      Deprecated.
      private java.lang.String jar
      Literal name of the artifact in the repository.
      private java.util.Properties properties
      Field properties.
      private java.lang.String type
      The type of dependency.
      private java.lang.String url
      This url will be provided to the user if the jar file cannot be downloaded from the central repository.
      private java.lang.String version
      The version of the dependency, e.g.
    • Constructor Summary

      Constructors 
      Constructor Description
      Dependency()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addProperty​(java.lang.String key, java.lang.String value)
      Method addProperty.
      boolean equals​(java.lang.Object o)  
      java.lang.String getArtifact()  
      java.lang.String getArtifactDirectory()  
      java.lang.String getArtifactId()
      Get the unique id for an artifact produced by the project group, e.g.
      java.lang.String getExtension()  
      java.lang.String getGroupId()
      Get the project group that produced the dependency, e.g.
      java.lang.String getId()
      Get Deprecated.
      java.lang.String getJar()
      Get literal name of the artifact in the repository.
      java.lang.String getKey()  
      java.util.Properties getProperties()
      Method getProperties.
      java.lang.String getProperty​(java.lang.String property)  
      java.lang.String getType()
      Get the type of dependency.
      java.lang.String getTypeDirectory()  
      java.lang.String getUrl()
      Get this url will be provided to the user if the jar file cannot be downloaded from the central repository.
      java.lang.String getVersion()
      Get the version of the dependency, e.g.
      int hashCode()  
      boolean isAddedToClasspath()  
      boolean isPlugin()  
      void setArtifactId​(java.lang.String artifactId)
      Set the unique id for an artifact produced by the project group, e.g.
      void setGroupId​(java.lang.String groupId)
      Set the project group that produced the dependency, e.g.
      void setId​(java.lang.String id)
      Set Deprecated.
      void setJar​(java.lang.String jar)
      Set literal name of the artifact in the repository.
      void setProperties​(java.util.Properties properties)
      Set properties about the dependency.
      void setType​(java.lang.String type)
      Set the type of dependency.
      void setUrl​(java.lang.String url)
      Set this url will be provided to the user if the jar file cannot be downloaded from the central repository.
      void setVersion​(java.lang.String version)
      Set the version of the dependency, e.g.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • id

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

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

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

        private java.lang.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 java.lang.String url
        This url will be provided to the user if the jar file cannot be downloaded from the central repository.
      • jar

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

        private java.lang.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 java.util.Properties properties
        Field properties.
    • Constructor Detail

      • Dependency

        public Dependency()
    • Method Detail

      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.String value)
        Method addProperty.
        Parameters:
        key - a key object.
        value - a value object.
      • getArtifactId

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

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

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

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

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

        public java.lang.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 java.lang.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 java.lang.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​(java.lang.String artifactId)
        Set the unique id for an artifact produced by the project group, e.g. maven-artifact.
        Parameters:
        artifactId - a artifactId object.
      • setGroupId

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

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

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

        public void setProperties​(java.util.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 - a properties object.
      • setType

        public void setType​(java.lang.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 - a type object.
      • setUrl

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

        public void setVersion​(java.lang.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 - a version object.
      • toString

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

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

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

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

        public java.lang.String getTypeDirectory()
      • getExtension

        public java.lang.String getExtension()
      • isAddedToClasspath

        public boolean isAddedToClasspath()
      • isPlugin

        public boolean isPlugin()
      • getProperty

        public java.lang.String getProperty​(java.lang.String property)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

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