Class MavenLocation

All Implemented Interfaces:
Serializable, Location<URL>
Direct Known Subclasses:
MavenCentralLocation

public class MavenLocation extends URLLocation
This location provides a way to download artifacts from a Maven repository, using a maven-like artifact location specification.
Note: instances of this class allow access to a single artifact and do not in any way handle Maven transitive dependencies.
Since:
6.1
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • MavenLocation

      public MavenLocation(String repositoryURL, String gav, String packaging) throws MalformedURLException
      Create this maven central location with the specified GAV string and packaging.

      Example:

      Location<URL> location = new MavenLocation("file:///home/me/.m2/repository", "org.jppf:jppf-admin:5.2.9", "jar");
      Parameters:
      repositoryURL - the URL of the Maven repository this location points to.
      gav - the maven identifier in format "groupId:artifactId:version".
      packaging - the type of packaging of the artifact: jar, war, etc.
      Throws:
      MalformedURLException - if resulting URL is incorrect.
    • MavenLocation

      public MavenLocation(String repositoryURL, String gav) throws MalformedURLException
      Create this maven central location with the specified GAV string and default "jar" packaging.

      Example:

      Location<URL> location = new MavenLocation("file:///home/me/.m2/repository", "org.jppf:jppf-admin:5.2.9");
      Parameters:
      repositoryURL - the URL of the Maven repository this location points to.
      gav - the maven identifier in format "groupId:artifactId:version".
      Throws:
      MalformedURLException - if resulting URL is incorrect.
    • MavenLocation

      public MavenLocation(String repositoryURL, String groupId, String artifactId, String version) throws MalformedURLException
      Create this maven central location with the specified group id, artifact id, version and default "jar" packaging.

      Example:

      Location<URL> location = new MavenLocation("file:///home/me/.m2/repository", "org.jppf", "jppf-admin", "5.2.9");
      Parameters:
      repositoryURL - the URL of the Maven repository this location points to.
      groupId - the maven group id.
      artifactId - the maven artifact id.
      version - the maven version of the artifact.
      Throws:
      MalformedURLException - if resulting URL is incorrect.
    • MavenLocation

      public MavenLocation(String repositoryURL, String groupId, String artifactId, String version, String packaging) throws MalformedURLException
      Create this maven central location with the specified group id, artifact id, version and packaging.

      Example:

      Location<URL> location = new MavenLocation("file:///home/me/.m2/repository", "org.jppf", "jppf-admin", "5.2.9", "jar");
      Parameters:
      repositoryURL - the URL of the Maven repository this location points to.
      groupId - the maven group id.
      artifactId - the maven artifact id.
      version - the maven version of the artifact.
      packaging - the type of packaging of the artifact: jar, war, etc.
      Throws:
      MalformedURLException - if resulting URL is incoreect.
  • Method Details

    • getOutputStream

      public OutputStream getOutputStream() throws Exception
      Since it is not possible to upload data directly to Maven central, this method will always throw an UnsupportedOperationException.
      Specified by:
      getOutputStream in interface Location<URL>
      Overrides:
      getOutputStream in class URLLocation
      Returns:
      an OutputStream instance.
      Throws:
      Exception - if an I/O error occurs.
    • getRepositoryURL

      public String getRepositoryURL()
      The URL of the Maven repository this location points to.
      Returns:
      the repository URL as a string.
    • getGroupId

      public String getGroupId()
      Get the group id of the correpsonding Maven artifact.
      Returns:
      the groupId string.
    • getArtifactId

      public String getArtifactId()
      Get the artifact id of the correpsonding Maven artifact.
      Returns:
      the artifactId string.
    • getVersion

      public String getVersion()
      Get the version of the correpsonding Maven artifact.
      Returns:
      the version string.
    • getPackaging

      public String getPackaging()
      Get the packaging of the correpsonding Maven artifact.
      Returns:
      the packaging string.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractLocation<URL>