in core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/DumpAuthMojo.java [74:128]
public void execute() throws MojoExecutionException, MojoFailureException {
Properties authProperties = new Properties();
for (String serverId : serverIds) {
getLog().info("[MAVEN-CORE-IT-LOG] Getting authentication info for server " + serverId);
AuthenticationInfo authInfo = wagonManager.getAuthenticationInfo(serverId);
if (authInfo != null) {
if (authInfo.getUserName() != null) {
authProperties.setProperty(serverId + ".username", authInfo.getUserName());
}
if (authInfo.getPassword() != null) {
authProperties.setProperty(serverId + ".password", authInfo.getPassword());
}
if (authInfo.getPrivateKey() != null) {
authProperties.setProperty(serverId + ".privateKey", authInfo.getPrivateKey());
}
if (authInfo.getPassphrase() != null) {
authProperties.setProperty(serverId + ".passphrase", authInfo.getPassphrase());
}
getLog().info("[MAVEN-CORE-IT-LOG] username = " + authInfo.getUserName());
getLog().info("[MAVEN-CORE-IT-LOG] password = " + authInfo.getPassword());
getLog().info("[MAVEN-CORE-IT-LOG] private key = " + authInfo.getPrivateKey());
getLog().info("[MAVEN-CORE-IT-LOG] passphrase = " + authInfo.getPassphrase());
} else {
getLog().info("[MAVEN-CORE-IT-LOG] (no authentication info available)");
}
}
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);
authProperties.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);
}