GAVUtil { static org.apache.maven.artifact.DefaultArtifact getArtifact(String coords) { DefaultArtifact aetherArtifact = new DefaultArtifact(coords); return new org.apache.maven.artifact.DefaultArtifact(aetherArtifact.getGroupId(), aetherArtifact.getArtifactId(), aetherArtifact.getVersion(), null, aetherArtifact.getExtension(), aetherArtifact.getClassifier(), null) { @Override public String getScope() { throw new UnsupportedOperationException(); } @Override public ArtifactHandler getArtifactHandler() { throw new UnsupportedOperationException(); } }; }    }
@Test public void testToArtifact() throws Exception { Artifact artifact = GAVUtil.getArtifact("com.sap.mytest:testArtifact:tar:classifier:1.0.0"); Assert.assertEquals("com.sap.mytest", artifact.getGroupId()); Assert.assertEquals("testArtifact", artifact.getArtifactId()); Assert.assertEquals("1.0.0", artifact.getVersion()); Assert.assertEquals("classifier", artifact.getClassifier()); Assert.assertEquals("tar", artifact.getType()); }