in src/main/java/org/apache/maven/plugins/help/SystemMojo.java [56:107]
public void execute() throws MojoExecutionException {
StringBuilder message = new StringBuilder();
message.append(LS);
message.append(StringUtils.repeat("=", LINE_LENGTH)).append(LS);
message.append(StringUtils.repeat("=", REPEAT));
message.append(" Platform Properties Details ");
message.append(StringUtils.repeat("=", REPEAT)).append(LS);
message.append(StringUtils.repeat("=", LINE_LENGTH)).append(LS);
message.append(LS);
message.append(StringUtils.repeat("=", LINE_LENGTH)).append(LS);
message.append("System Properties").append(LS);
message.append(StringUtils.repeat("=", LINE_LENGTH)).append(LS);
Properties systemProperties = System.getProperties();
for (String key : systemProperties.stringPropertyNames()) {
message.append(LS);
message.append(key).append("=").append(systemProperties.getProperty(key));
}
message.append(LS).append(LS);
message.append(StringUtils.repeat("=", LINE_LENGTH)).append(LS);
message.append("Environment Variables").append(LS);
message.append(StringUtils.repeat("=", LINE_LENGTH)).append(LS);
Properties envVars = CommandLineUtils.getSystemEnvVars();
for (String key : envVars.stringPropertyNames()) {
message.append(LS);
message.append(key).append("=").append(envVars.getProperty(key));
}
message.append(LS);
if (output != null) {
StringBuilder sb = new StringBuilder();
sb.append("Generated by Maven Help Plugin").append(LS);
sb.append("See: https://maven.apache.org/plugins/maven-help-plugin/")
.append(LS)
.append(LS);
sb.append(message.toString());
try {
writeFile(output, sb);
} catch (IOException e) {
throw new MojoExecutionException("Cannot write system report to output: " + output, e);
}
getLog().info("System report written to: " + output);
} else {
getLog().info(message);
}
}