Class RepoFile

java.lang.Object
bm.repositories.RepoFile

public class RepoFile extends Object
Data holder for a typical maven repository file with group, name and version.
  • Field Details

    • group

      public final String group
      group name of the artifact
    • name

      public final String name
      name of the artifact
    • version

      public final String version
      version of the artifact
    • classifier

      public final String classifier
      classifier of the artifact, may be null
  • Constructor Details

    • RepoFile

      public RepoFile(String group, String name, String version, String classifier, String type)
      Creates the object
      Parameters:
      group - artifact group
      name - artifact name
      version - artifact version
      type - typically the file extension, though without the dot
  • Method Details

    • fromGradleShort

      public static RepoFile fromGradleShort(String groupNameVersionClassifier, String type) throws BuildProblemException
      Creates the object.
      Parameters:
      groupNameVersionClassifier - must have the form group:name:version:classifier, where the classifier is optional, i.e. after a split on ':' it must have 3 or 4 elements.
      Returns:
      the created RepoFile
      Throws:
      BuildProblemException
    • repoUrl

      public URL repoUrl(String repoBaseUrl) throws BuildProblemException
      Creates a repository URL path and appends it to the given repository base URL. This works with https://repo1.maven.org but may work with others.
      Parameters:
      repoBaseUrl - to prefix to the constructed path
      Returns:
      basically repoBaseUrl + group/name/version/filename() with the dots in group being replaced by '/'
      Throws:
      BuildProblemException
    • fetch

      public void fetch(String repoBaseUrl, Path libDir) throws BuildProblemException
      Throws:
      BuildProblemException
    • asTarget

      public FileTarget asTarget(String repoBaseUrl, Path libDir)
    • filename

      public Path filename(Path directory)
      Returns the file name created from name, version and type as name-version.type
      Parameters:
      directory - to prefix to the returned name
      Returns:
      the path to the artifact file
    • filename

      public String filename()
      Returns the file name created from name, version and type as name-version-classifier.type where the "-classifier" part is optional.
      Returns:
      the path to the artifact file