in core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpVersionMojo.java [85:126]
public void execute() throws MojoExecutionException {
Properties wagonProperties = new Properties();
Object wagon;
try {
wagon = wagonManager.getWagon(providerHint);
String resource = "/META-INF/maven/" + providerGroupId + "/" + providerArtifactId + "/pom.properties";
InputStream is = wagon.getClass().getResourceAsStream(resource);
wagonProperties.load(is);
} catch (IOException e) {
throw new MojoExecutionException("Wagon properties could not be read: " + e.getMessage(), e);
} catch (Exception e) {
getLog().info("[MAVEN-CORE-IT-LOG] No wagon available for " + providerHint);
wagonProperties.setProperty("missing", "true");
}
if (!propertiesFile.isAbsolute()) {
propertiesFile = new File(basedir, propertiesFile.getPath());
}
getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + propertiesFile);
OutputStream out = null;
try {
propertiesFile.getParentFile().mkdirs();
out = new FileOutputStream(propertiesFile);
wagonProperties.store(out, "MAVEN-CORE-IT-LOG");
} catch (IOException e) {
throw new MojoExecutionException("Output file could not be created: " + propertiesFile, e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
// just ignore
}
}
}
getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + propertiesFile);
}