2222import java .net .MalformedURLException ;
2323import java .net .URL ;
2424import java .util .ArrayList ;
25- import java .util .HashMap ;
25+ import java .util .Collection ;
2626import java .util .List ;
27- import java .util .Map ;
2827
2928import org .apache .maven .plugin .logging .Log ;
3029import org .apache .maven .plugins .issues .Issue ;
3534import org .apache .maven .settings .crypto .DefaultSettingsDecryptionRequest ;
3635import org .apache .maven .settings .crypto .SettingsDecrypter ;
3736import org .apache .maven .settings .crypto .SettingsDecryptionResult ;
38- import org .eclipse .egit .github .core .Label ;
39- import org .eclipse .egit .github .core .client .GitHubClient ;
40- import org .eclipse .egit .github .core .service .IssueService ;
37+ import org .kohsuke .github .GHIssue ;
38+ import org .kohsuke .github .GHIssueState ;
39+ import org .kohsuke .github .GHLabel ;
40+ import org .kohsuke .github .GitHubBuilder ;
4141
4242/**
4343 * @since 2.8
@@ -47,7 +47,7 @@ public class GitHubDownloader {
4747 /**
4848 * The github client.
4949 */
50- private GitHubClient client ;
50+ private GitHubBuilder client ;
5151
5252 /**
5353 * A boolean to indicate if we should include open issues as well
@@ -80,7 +80,7 @@ public GitHubDownloader(
8080 int githubPort ,
8181 boolean includeOpenIssues ,
8282 boolean onlyMilestoneIssues )
83- throws MalformedURLException {
83+ throws IOException {
8484 this .includeOpenIssues = includeOpenIssues ;
8585 this .onlyMilestoneIssues = onlyMilestoneIssues ;
8686
@@ -89,9 +89,9 @@ public GitHubDownloader(
8989 // The githubclient prefers to connect to 'github.com' using the api domain, unlike github enterprise
9090 // which can connect fine using its domain, so for github.com use empty constructor
9191 if (githubURL .getHost ().equalsIgnoreCase ("github.com" )) {
92- this .client = new GitHubClient ();
92+ this .client = new GitHubBuilder ();
9393 } else {
94- this .client = new GitHubClient ( githubURL .getHost (), githubPort , githubScheme );
94+ this .client = new GitHubBuilder (). withEndpoint ( githubScheme + githubURL .getHost () + githubPort );
9595 }
9696
9797 this .githubIssueURL = project .getIssueManagement ().getUrl ();
@@ -119,7 +119,7 @@ public GitHubDownloader(
119119 this .githubRepo = urlPathParts [1 ];
120120 }
121121
122- protected Issue createIssue (org . eclipse . egit . github . core . Issue githubIssue ) {
122+ protected Issue createIssue (GHIssue githubIssue ) throws IOException {
123123 Issue issue = new Issue ();
124124
125125 issue .setKey (String .valueOf (githubIssue .getNumber ()));
@@ -155,9 +155,9 @@ protected Issue createIssue(org.eclipse.egit.github.core.Issue githubIssue) {
155155 issue .setStatus ("open" );
156156 }
157157
158- List < Label > labels = githubIssue .getLabels ();
158+ final Collection < GHLabel > labels = githubIssue .getLabels ();
159159 if (labels != null && !labels .isEmpty ()) {
160- issue .setType (labels .get (0 ).getName ());
160+ issue .setType (labels .stream (). findAny (). get ().getName ());
161161 }
162162
163163 return issue ;
@@ -166,24 +166,20 @@ protected Issue createIssue(org.eclipse.egit.github.core.Issue githubIssue) {
166166 public List <Issue > getIssueList () throws IOException {
167167 List <Issue > issueList = new ArrayList <>();
168168
169- IssueService service = new IssueService (client );
170- Map <String , String > issueFilter = new HashMap <>();
171-
172169 if (includeOpenIssues ) {
173- // Adding open issues
174-
175- for (org . eclipse . egit . github . core . Issue issue : service . getIssues ( githubOwner , githubRepo , issueFilter ) ) {
170+ final List < GHIssue > openIssues =
171+ client . build (). getRepository ( githubOwner + "/" + githubRepo ). getIssues ( GHIssueState . OPEN );
172+ for (final GHIssue issue : openIssues ) {
176173 if (!onlyMilestoneIssues || issue .getMilestone () != null ) {
177174 issueList .add (createIssue (issue ));
178175 }
179176 }
180177 }
181178
182- // Adding closed issues
183-
184- issueFilter .put ("state" , "closed" );
179+ final List <GHIssue > closedIssues =
180+ client .build ().getRepository (githubOwner + "/" + githubRepo ).getIssues (GHIssueState .CLOSED );
185181
186- for (org . eclipse . egit . github . core . Issue issue : service . getIssues ( githubOwner , githubRepo , issueFilter ) ) {
182+ for (final GHIssue issue : closedIssues ) {
187183 if (!onlyMilestoneIssues || issue .getMilestone () != null ) {
188184 issueList .add (createIssue (issue ));
189185 }
@@ -207,7 +203,7 @@ public void configureAuthentication(
207203 server = result .getServer ();
208204 String user = server .getUsername ();
209205 String password = server .getPassword ();
210- this .client .setCredentials (user , password );
206+ this .client .withPassword (user , password );
211207
212208 configured = true ;
213209 break ;
0 commit comments