Package org.savantbuild.dep
Class ArtifactTools
java.lang.Object
org.savantbuild.dep.ArtifactTools
This class is a toolkit for handling artifact operations.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.savantbuild.domain.VersiondetermineSemanticVersion(ArtifactSpec spec, Map<String, org.savantbuild.domain.Version> mappings) Determines the semantic version of an artifact based on the original version from the specification, which might be a Maven version.static PathgenerateXML(ArtifactMetaData artifactMetaData) Generates a temporary file that contains ArtifactMetaData XML which includes all the artifacts in the ArtifactMetaData given.static ArtifactMetaDataparseArtifactMetaData(Path file, Map<String, org.savantbuild.domain.Version> mappings) Parses the MetaData from the given Savant .amd file.
-
Field Details
-
VersionError
Maven version error.- See Also:
-
-
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.VersionExceptionDetermines 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
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, IOExceptionParses 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.
-