GradleResolver implements MavenResolver { String toGradleArtifactFileName(ArtifactCoordinates artifactCoordinates, String packaging) { StringBuilder sbFileFilter = new StringBuilder(); sbFileFilter .append(artifactCoordinates.getArtifactId()) .append("-") .append(artifactCoordinates.getVersion()); if (artifactCoordinates.getClassifier() != null && artifactCoordinates.getClassifier().length() > 0) { sbFileFilter .append("-") .append(artifactCoordinates.getClassifier()); } sbFileFilter .append(".") .append(packaging); return sbFileFilter.toString(); } GradleResolver(String gradleCachePath); @Override File resolveArtifact(ArtifactCoordinates artifactCoordinates, String packaging);  }
@Test public void testToGradleArtifactFileName(){ String group = "org.wildfly.swarm"; String packaging = "jar"; String artifact = "test"; String version = "1.0"; ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(group, artifact, version); GradleResolver resolver = new GradleResolver(null); String artifactFileName = resolver.toGradleArtifactFileName(artifactCoordinates, packaging); assertEquals(artifact + "-" + version + "." + packaging, artifactFileName); }
@Test public void testToGradleArtifactFileName_withClassifier(){ String group = "org.wildfly.swarm"; String packaging = "jar"; String artifact = "test"; String version = "1.0"; String classifier = "sources"; ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(group, artifact, version, classifier); GradleResolver resolver = new GradleResolver(null); String artifactFileName = resolver.toGradleArtifactFileName(artifactCoordinates, packaging); assertEquals(artifact + "-" + version + "-"+ classifier + "." + packaging, artifactFileName); }