Class ArtifactTools

java.lang.Object
org.savantbuild.dep.ArtifactTools

public class ArtifactTools extends Object
This class is a toolkit for handling artifact operations.
  • Field Details

  • Constructor Details

    • ArtifactTools

      public ArtifactTools()
  • Method Details

    • determineSemanticVersion

      public static org.savantbuild.domain.Version determineSemanticVersion(ArtifactSpec spec, Map<String,org.savantbuild.domain.Version> mappings) throws org.savantbuild.domain.VersionException
      Determines the semantic version of an artifact based on the original version from the specification, which might be a Maven version.
      Parameters:
      spec - The specification.
      mappings - The version mappings from non-semantic to semantic.
      Returns:
      The version and never null.
      Throws:
      org.savantbuild.domain.VersionException - If the version is non-semantic and there is no mapping.
    • generateXML

      public static Path generateXML(ArtifactMetaData artifactMetaData) throws IOException
      Generates a temporary file that contains ArtifactMetaData XML which includes all the artifacts in the ArtifactMetaData given.
      Parameters:
      artifactMetaData - The MetaData object to serialize to XML.
      Returns:
      The temp file and never null.
      Throws:
      IOException - If the temp could not be created or the XML could not be written.
    • parseArtifactMetaData

      public static ArtifactMetaData parseArtifactMetaData(Path file, Map<String,org.savantbuild.domain.Version> mappings) throws SAXException, org.savantbuild.domain.VersionException, ParserConfigurationException, IOException
      Parses the MetaData from the given Savant .amd file.
      Parameters:
      file - The File to read the XML MetaData information from.
      mappings - The semantic version mappings that are used when the AMD is parsed and uses non-semantic versions for transitive dependencies.
      Returns:
      The MetaData parsed.
      Throws:
      SAXException - If the SAX parsing failed.
      org.savantbuild.domain.VersionException - If any of the version strings could not be parsed.
      ParserConfigurationException - If the parser configuration in the JDK is invalid.
      IOException - If the parse operation failed because of an IO error.