@Test public void testIvyDependencyGeneration() throws ProviderImplementationException { DependencySynonymFormatter formatter = compatibleDependencyFormatRegistry.getProviderImplementation(Maven2LayoutProvider.ALIAS, IvyDependencyFormatter.ALIAS); assertThat(formatter).as("Failed to look up dependency synonym formatter!").isNotNull(); MavenArtifactCoordinates coordinates = new MavenArtifactCoordinates(); coordinates.setGroupId("org.carlspring.strongbox"); coordinates.setArtifactId("maven-snippet"); coordinates.setVersion("1.0"); coordinates.setExtension("jar"); String snippet = formatter.getDependencySnippet(coordinates); System.out.println(snippet); assertThat(snippet) .as("Failed to generate dependency!") .isEqualTo("<dependency org=\"" + coordinates.getGroupId() + "\"" + " name=\"" + coordinates.getArtifactId() + "\"" + " rev=\"" + coordinates.getVersion() + "\" />\n"); }
@Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { MavenArtifactCoordinates coordinates = (MavenArtifactCoordinates) artifactCoordinates; return "<dependency org=\"" + coordinates.getGroupId() + "\"" + " name=\"" + coordinates.getArtifactId() + "\"" + " rev=\"" + coordinates.getVersion() + "\" />\n"; }
IvyDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { MavenArtifactCoordinates coordinates = (MavenArtifactCoordinates) artifactCoordinates; return "<dependency org=\"" + coordinates.getGroupId() + "\"" + " name=\"" + coordinates.getArtifactId() + "\"" + " rev=\"" + coordinates.getVersion() + "\" />\n"; } }
IvyDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { MavenArtifactCoordinates coordinates = (MavenArtifactCoordinates) artifactCoordinates; return "<dependency org=\"" + coordinates.getGroupId() + "\"" + " name=\"" + coordinates.getArtifactId() + "\"" + " rev=\"" + coordinates.getVersion() + "\" />\n"; }  }
IvyDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { MavenArtifactCoordinates coordinates = (MavenArtifactCoordinates) artifactCoordinates; return "<dependency org=\"" + coordinates.getGroupId() + "\"" + " name=\"" + coordinates.getArtifactId() + "\"" + " rev=\"" + coordinates.getVersion() + "\" />\n"; }  @PostConstruct @Override void register(); @Override String getLayout(); @Override String getFormatAlias(); @Override String getDependencySnippet(ArtifactCoordinates artifactCoordinates); }
IvyDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { MavenArtifactCoordinates coordinates = (MavenArtifactCoordinates) artifactCoordinates; return "<dependency org=\"" + coordinates.getGroupId() + "\"" + " name=\"" + coordinates.getArtifactId() + "\"" + " rev=\"" + coordinates.getVersion() + "\" />\n"; }  @PostConstruct @Override void register(); @Override String getLayout(); @Override String getFormatAlias(); @Override String getDependencySnippet(ArtifactCoordinates artifactCoordinates); static final String ALIAS; }