[MCHANGELOG-66] changelog for perforce fails because of default clientspec

o Add the ability to configure system properties, that can be picked up by Maven SCM. This is how it is handled in the maven-scm-plugin.

git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@557598 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
index 3db7554..e893f7c 100644
--- a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
+++ b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
@@ -65,6 +65,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
+import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 
@@ -292,6 +293,13 @@
     private String connection;
 
     /**
+     * The system properties to use (needed by the perforce scm provider).
+     *
+     * @parameter
+     */
+    private Properties systemProperties;
+
+    /**
      * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
      */
     public void executeReport( Locale locale )
@@ -307,6 +315,23 @@
 
         verifySCMTypeParams();
 
+        if ( systemProperties != null )
+        {
+            // Add all system properties configured by the user
+            Iterator iter = systemProperties.keySet().iterator();
+
+            while ( iter.hasNext() )
+            {
+                String key = (String) iter.next();
+
+                String value = systemProperties.getProperty( key );
+
+                System.setProperty( key, value );
+
+                getLog().debug( "Setting system property: " + key + "=" + value );
+            }
+        }
+
         doGenerateReport( getChangedSets(), getBundle( locale ), getSink() );
     }