Author: olamy
Date: Fri Jan 23 04:20:56 2015
New Revision: 1654113
URL: http://svn.apache.org/r1654113
Log:
[MCHANGES-305] Provide support for private Github repos
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubDownloader.java
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubMojo.java
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java?rev=1654113&r1=1654112&r2=1654113&view=diff
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
(original)
+++
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
Fri Jan 23 04:20:56 2015
@@ -454,6 +454,14 @@ public class AnnouncementMojo
@Parameter( defaultValue = "80", property = "changes.githubAPIPort" )
private int githubAPIPort;
+ /**
+ * The settings.xml server id to be used to authenticate into github api
domain. Only use if using github enterprise.
+ *
+ * @since 2.12
+ */
+ @Parameter ( defaultValue = "github" )
+ private String githubAPIServerId;
+
private ReleaseUtils releaseUtils = new ReleaseUtils( getLog() );
private ChangesXML xml;
@@ -849,6 +857,9 @@ public class AnnouncementMojo
{
GitHubDownloader issueDownloader =
new GitHubDownloader( project, githubAPIScheme, githubAPIPort,
false, true );
+
+ issueDownloader.configureAuthentication( githubAPIServerId,
settings, getLog() );
+
return getReleases( issueDownloader.getIssueList(), new
GitHubIssueManagementSystem() );
}
catch ( Exception e )
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubDownloader.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubDownloader.java?rev=1654113&r1=1654112&r2=1654113&view=diff
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubDownloader.java
(original)
+++
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubDownloader.java
Fri Jan 23 04:20:56 2015
@@ -20,7 +20,11 @@ package org.apache.maven.plugin.github;
*/
import org.apache.maven.plugin.issues.Issue;
+import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+
import org.eclipse.egit.github.core.Label;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.IssueService;
@@ -207,4 +211,29 @@ public class GitHubDownloader
return issueList;
}
+ public void configureAuthentication( String githubAPIServerId, Settings
settings, Log log )
+ {
+ boolean configured = false;
+
+ List<Server> servers = settings.getServers();
+
+ for ( Server server : servers )
+ {
+ if ( server.getId().equals( githubAPIServerId ) )
+ {
+ String user = server.getUsername();
+ String password = server.getPassword();
+ this.client.setCredentials( user, password );
+
+ configured = true;
+ break;
+}
+ }
+
+ if ( !configured )
+ {
+ log.warn( "Can't find server id [" + githubAPIServerId + "]
configured in githubAPIServerId." );
+ }
+ }
+
}
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubMojo.java?rev=1654113&r1=1654112&r2=1654113&view=diff
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubMojo.java
(original)
+++
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/github/GitHubMojo.java
Fri Jan 23 04:20:56 2015
@@ -28,6 +28,7 @@ import org.apache.maven.plugin.issues.Is
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.reporting.MavenReportException;
+import org.apache.maven.settings.Settings;
import java.net.MalformedURLException;
import java.util.HashMap;
@@ -94,6 +95,18 @@ public class GitHubMojo
private int githubAPIPort;
/**
+ * The settings.xml server id to be used to authenticate into github api
domain. Only use if using github enterprise.
+ */
+ @Parameter ( defaultValue = "github" )
+ private String githubAPIServerId;
+
+ /**
+ * Settings XML configuration.
+ */
+ @Parameter( defaultValue = "${settings}", readonly = true, required = true
)
+ private Settings settings;
+
+ /**
* Boolean which says if we should include open issues in the report.
*/
@Parameter ( defaultValue = "true" )
@@ -166,6 +179,8 @@ public class GitHubMojo
GitHubDownloader issueDownloader =
new GitHubDownloader( project, githubAPIScheme, githubAPIPort,
includeOpenIssues, onlyMilestoneIssues );
+ issueDownloader.configureAuthentication( githubAPIServerId,
settings, getLog() );
+
List<Issue> issueList = issueDownloader.getIssueList();
if ( onlyCurrentVersion )