use of org.commonjava.maven.galley.maven.parse.PomPeek in project indy by Commonjava.
the class AbstractSkimFunctionalTest method loadPom.
protected PomRef loadPom(final String name, final Map<String, String> substitutions) {
try {
final InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name + ".pom");
String pom = IOUtils.toString(stream);
IOUtils.closeQuietly(stream);
for (final Map.Entry<String, String> entry : substitutions.entrySet()) {
pom = pom.replace("@" + entry.getKey() + "@", entry.getValue());
}
final PomPeek peek = new PomPeek(pom, false);
final ProjectVersionRef gav = peek.getKey();
final String path = String.format("%s/%s/%s/%s-%s.pom", gav.getGroupId().replace('.', '/'), gav.getArtifactId(), gav.getVersionString(), gav.getArtifactId(), gav.getVersionString());
return new PomRef(pom, path);
} catch (final Exception e) {
e.printStackTrace();
fail("Failed to read POM from: " + name);
}
return null;
}
Aggregations