List of usage examples for org.apache.maven.artifact.metadata ArtifactMetadataRetrievalException ArtifactMetadataRetrievalException
@Deprecated
public ArtifactMetadataRetrievalException(String message)
From source file:org.apache.felix.karaf.tooling.features.GenerateFeaturesFileMojo.java
License:Apache License
protected String getBestVersionForArtifact(Artifact artifact, List<ArtifactVersion> versions) throws ArtifactMetadataRetrievalException { if (versions.size() == 0) { throw new ArtifactMetadataRetrievalException("No wrapper bundle available for " + artifact); }//from w w w .j a v a2 s . com Collections.sort(versions, Collections.reverseOrder()); //check for same version for (ArtifactVersion version : versions) { if (version.toString().startsWith(artifact.getVersion())) { return version.toString(); } } //check for same major/minor version for (ArtifactVersion version : versions) { String[] elements = version.toString().split("\\."); if (elements.length >= 2 && artifact.getVersion().startsWith(elements[0] + "." + elements[1])) { return version.toString(); } } throw new ArtifactMetadataRetrievalException( "No suitable version found for " + artifact + " wrapper bundle"); }