LeiningenDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { MavenArtifactCoordinates coordinates = (MavenArtifactCoordinates) artifactCoordinates; return "[" + coordinates.getGroupId() + "/" + coordinates.getArtifactId() + " " + "\"" + coordinates.getVersion() +"\"" + (coordinates.getExtension() != null && !coordinates.getExtension().equals("jar") ? " :extension \"" + coordinates.getExtension() + "\"" : "") + (coordinates.getClassifier() != null ? " :classifier \"" + coordinates.getClassifier() + "\"" : "") + "]\n"; }  @PostConstruct @Override void register(); @Override String getLayout(); @Override String getFormatAlias(); @Override String getDependencySnippet(ArtifactCoordinates artifactCoordinates); static final String ALIAS; }
@Test public void testIvyDependencyGenerationWithoutClassifier() throws ProviderImplementationException { DependencySynonymFormatter formatter = compatibleDependencyFormatRegistry.getProviderImplementation(Maven2LayoutProvider.ALIAS, LeiningenDependencyFormatter.ALIAS); assertThat(formatter).as("Failed to look up dependency synonym formatter!").isNotNull(); String snippet = formatter.getDependencySnippet(coordinates); System.out.println(snippet); assertThat(snippet) .as("Failed to generate dependency!") .isEqualTo("[org.carlspring.strongbox/maven-snippet \"1.0\"]\n"); }
@Test public void testIvyDependencyGenerationWithNonStandardType() throws ProviderImplementationException { DependencySynonymFormatter formatter = compatibleDependencyFormatRegistry.getProviderImplementation(Maven2LayoutProvider.ALIAS, LeiningenDependencyFormatter.ALIAS); assertThat(formatter).as("Failed to look up dependency synonym formatter!").isNotNull(); coordinates.setExtension("zip"); String snippet = formatter.getDependencySnippet(coordinates); System.out.println(snippet); assertThat(snippet) .as("Failed to generate dependency!") .isEqualTo("[org.carlspring.strongbox/maven-snippet \"1.0\" :extension \"zip\"]\n"); }
@Test public void testIvyDependencyGenerationWithNonStandardTypeAndClassifier() throws ProviderImplementationException { DependencySynonymFormatter formatter = compatibleDependencyFormatRegistry.getProviderImplementation(Maven2LayoutProvider.ALIAS, LeiningenDependencyFormatter.ALIAS); assertThat(formatter).as("Failed to look up dependency synonym formatter!").isNotNull(); coordinates.setExtension("zip"); coordinates.setClassifier("jdk12"); String snippet = formatter.getDependencySnippet(coordinates); System.out.println(snippet); assertThat(snippet) .as("Failed to generate dependency!") .isEqualTo("[org.carlspring.strongbox/maven-snippet \"1.0\" :extension \"zip\" :classifier \"jdk12\"]\n"); }
@Test public void testIvyDependencyGenerationWithClassifier() throws ProviderImplementationException { DependencySynonymFormatter formatter = compatibleDependencyFormatRegistry.getProviderImplementation(Maven2LayoutProvider.ALIAS, LeiningenDependencyFormatter.ALIAS); assertThat(formatter).as("Failed to look up dependency synonym formatter!").isNotNull(); coordinates.setClassifier("jdk12"); String snippet = formatter.getDependencySnippet(coordinates); System.out.println(snippet); assertThat(snippet) .as("Failed to generate dependency!") .isEqualTo("[org.carlspring.strongbox/maven-snippet \"1.0\" :classifier \"jdk12\"]\n"); }