Class MavenEntry

java.lang.Object
aQute.bnd.maven.support.MavenEntry
All Implemented Interfaces:
Closeable, AutoCloseable

public class MavenEntry extends Object implements Closeable
An entry (a group/artifact) in the maven cache in the .m2/repository directory. It provides methods to get the pom and the artifact.
  • Field Details

  • Constructor Details

    • MavenEntry

      MavenEntry(Maven maven, String path)
      Constructor.
      Parameters:
      maven -
      path -
    • MavenEntry

      MavenEntry(Maven maven, String path, Reporter reporter)
      Constructor.
      Parameters:
      maven -
      path -
      reporter -
  • Method Details

    • getArtifactFile

      public File getArtifactFile()
    • getPom

      public CachedPom getPom(URI[] urls) throws Exception
      This is the method to get the POM for a cached entry.
      Parameters:
      urls - The allowed URLs
      Returns:
      a CachedPom for this maven entry
      Throws:
      Exception - If something goes haywire
    • download

      boolean download(URI repo, String path) throws MalformedURLException
      Download a resource from the given repo.
      Parameters:
      repo - The base url for the repo
      path - The path part
      Throws:
      MalformedURLException
    • toURL

      URL toURL(URI base, String path) throws MalformedURLException
      Converts a repo + path to a URL..
      Parameters:
      base - The base repo
      path - The path in the directory + url
      Returns:
      a URL that points to the file in the repo
      Throws:
      MalformedURLException
    • isValid

      private boolean isValid()
      Check if this is a valid cache directory, might probably need some more stuff.
      Returns:
      true if valid
    • setProperty

      private void setProperty(String key, String value)
      We maintain a set of bnd properties in the cache directory.
      Parameters:
      key - The key for the property
      value - The value for the property
    • getProperties

      protected Properties getProperties()
      Answer the properties, loading if needed.
    • getProperty

      private String getProperty(String key)
      Answer a property.
      Parameters:
      key - The key
      Returns:
      The value
    • saveProperties

      private void saveProperties() throws IOException
      Throws:
      IOException
    • createPom

      private CachedPom createPom(URI url) throws Exception
      Help function to create the POM and record its source.
      Parameters:
      url - the repo from which it was constructed
      Returns:
      the new pom
      Throws:
      Exception
    • verify

      boolean verify(URI repo, String path) throws Exception
      Verify that the repo has a checksum file for the given path and that this checksum matchs.
      Parameters:
      repo - The repo
      path - The file id
      Returns:
      true if there is a digest and it matches one of the algorithms
      Throws:
      Exception
    • verify

      private boolean verify(URI repo, String path, String algorithm) throws Exception
      Verify the path against its digest for the given algorithm.
      Parameters:
      repo -
      path -
      algorithm -
      Throws:
      Exception
    • getArtifact

      public File getArtifact() throws Exception
      Throws:
      Exception
    • getPomFile

      public File getPomFile()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • remove

      public void remove()