diff --git a/pom.xml b/pom.xml index 9a632f23..fe2801a2 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 8 - 3.6.3 + 4.0.0-alpha-6-SNAPSHOT 2023-03-14T21:31:56Z diff --git a/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java b/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java index cf237086..c43ff8b1 100644 --- a/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java +++ b/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java @@ -22,10 +22,11 @@ import java.io.StringWriter; import java.net.InetAddress; import java.net.UnknownHostException; -import java.util.ArrayList; import java.util.List; import java.util.Properties; +import org.apache.maven.api.settings.InputLocation; +import org.apache.maven.api.settings.InputSource; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -33,8 +34,8 @@ import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Server; import org.apache.maven.settings.Settings; -import org.apache.maven.settings.SettingsUtils; import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.settings.v4.SettingsXpp3WriterEx; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter; import org.codehaus.plexus.util.xml.XMLWriter; @@ -67,6 +68,14 @@ public class EffectiveSettingsMojo extends AbstractEffectiveMojo { @Parameter(property = "showPasswords", defaultValue = "false") private boolean showPasswords; + /** + * Output POM input location as comments. + * + * @since 3.5.0 + */ + @Parameter(property = "verbose", defaultValue = "false") + private boolean verbose = false; + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- @@ -95,6 +104,10 @@ public void execute() throws MojoExecutionException { writeEffectiveSettings(copySettings, writer); String effectiveSettings = prettyFormat(w.toString(), encoding, false); + if (verbose) { + // tweak location tracking comment, that are put on a separate line by pretty print + effectiveSettings = effectiveSettings.replaceAll("(?m)>\\s+