private static PackagingType toPackagingType(final String type) { assert type != null : "Should not be fed a null type via internals (regardless of user input)"; PackagingType parsedPackagingType = null; try { parsedPackagingType = PackagingType.of(type); } catch (final IllegalArgumentException iae) { // Exception translate throw new CoordinateParseException(iae.getMessage()); } return parsedPackagingType; }
} catch (final NoSuchElementException nsee) { throw new CoordinateParseException("Canonical form must be \"groupId:artifactId\"; got: " + canonicalForm); throw new CoordinateParseException("Canonical form must be \"groupId:artifactId\"; got: " + canonicalForm);
throw new CoordinateParseException("Bad artifact coordinates" + ", expected format is <groupId>:<artifactId>[:<packagingType>[:<classifier>]]:(<version>|'?'), got: " + coordinates);
public static Artifact asArtifact(MavenCoordinate coordinate, ArtifactTypeRegistry registry) throws CoordinateParseException { try { return new DefaultArtifact(coordinate.getGroupId(), coordinate.getArtifactId(), coordinate.getClassifier(), coordinate.getPackaging().getExtension(), coordinate.getVersion(), registry.get(coordinate.getPackaging().getId())); } catch (IllegalArgumentException e) { throw new CoordinateParseException("Unable to create artifact from invalid coordinates " + coordinate.toCanonicalForm()); } }
public static Artifact asArtifact(MavenCoordinate coordinate, ArtifactTypeRegistry registry) throws CoordinateParseException { try { return new DefaultArtifact(coordinate.getGroupId(), coordinate.getArtifactId(), coordinate.getClassifier(), coordinate.getPackaging().getExtension(), coordinate.getVersion(), registry.get(coordinate.getPackaging().getId())); } catch (IllegalArgumentException e) { throw new CoordinateParseException("Unable to create artifact from invalid coordinates " + coordinate.toCanonicalForm()); } }