Package adalid.jee2

Class ProjectDependency


  • public class ProjectDependency
    extends Object
    Author:
    Jorge Campins
    • Method Detail

      • getGroupId

        public String getGroupId()
        Returns:
        the group ID
      • getArtifactId

        public String getArtifactId()
        Returns:
        the artifact ID
      • getVersion

        public String getVersion()
        Returns:
        the version
      • getClassifier

        public String getClassifier()
        The classifier element distinguishes artifacts that were built from the same POM but differ in content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number. As a motivation for this element, consider for example a project that offers an artifact targeting Java 11 but at the same time also an artifact that still supports Java 1.8. The first artifact could be equipped with the classifier jdk11 and the second one with jdk8 such that clients can choose which one to use. Another common use case for classifiers is to attach secondary artifacts to the project's main artifact. If you browse the Maven central repository, you will notice that the classifiers sources and javadoc are used to deploy the project source code and API docs along with the packaged class files.
        Returns:
        the classifier
      • setClassifier

        public ProjectDependency setClassifier​(String classifier)
        Parameters:
        classifier - the classifier to set
        Returns:
        this
      • getScope

        public String getScope()
        The scope element refers to the classpath of the task at hand (compiling and runtime, testing, etc.) as well as how to limit the transitivity of a dependency. There are five scopes available:
        • compile - this is the default scope, used if none is specified. Compile dependencies are available in all classpaths. Furthermore, those dependencies are propagated to dependent projects.
        • provided - this is much like compile, but indicates you expect the JDK or a container to provide it at runtime. It is only available on the compilation and test classpath, and is not transitive.
        • runtime - this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.
        • test - this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases. It is not transitive.
        • system - this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.
        Returns:
        the scope
      • getSystemPath

        public String getSystemPath()
        The systemPath element is used only if the dependency scope is system. Otherwise, the build will fail if this element is set. The path must be absolute, so it is recommended to use a property to specify the machine-specific path (more on properties below), such as ${java.home}/lib. Since it is assumed that system scope dependencies are installed a priori, Maven does not check the repositories for the project, but instead checks to ensure that the file exists. If not, Maven fails the build and suggests that you download and install it manually.
        Returns:
        the system path
      • setSystemPath

        public ProjectDependency setSystemPath​(String systemPath)
        Parameters:
        systemPath - the system path to set
        Returns:
        this
      • getType

        public String getType()
        The type element corresponds to the chosen dependency type. This defaults to jar. While it usually represents the extension on the filename of the dependency, that is not always the case: a type can be mapped to a different extension and a classifier. The type often corresponds to the packaging used, though this is also not always the case. Some examples are jar, ejb-client and test-jar: see default artifact handlers for a list. New types can be defined by plugins that set extensions to true, so this is not a complete list.
        Returns:
        the type
      • isOptional

        public boolean isOptional()
        The optional element marks a dependency optional when this project itself is a dependency. For example, imagine a project A that depends upon project B to compile a portion of code that may not be used at runtime, then we may have no need for project B for all project. So if project X adds project A as its own dependency, then Maven does not need to install project B at all. In the shortest terms, optional lets other projects know that, when you use this project, you do not require this dependency in order to work correctly.
        Returns:
        the optional indicator
      • setOptional

        public ProjectDependency setOptional​(boolean optional)
        Parameters:
        optional - the optional indicator to set
        Returns:
        this
      • isValid

        public boolean isValid()
        Returns:
        the validity indicator