diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 8a086a74e7..f009de37cb 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -19,4 +19,4 @@ jobs: - name: Maven Download all dependencies run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline - name: Maven Build - run: mvn -B package --file pom.xml + run: mvn -B install site --file pom.xml diff --git a/pom.xml b/pom.xml index 4f1be9cf7e..2b24c88e84 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,18 @@ + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.11.2 + + + org.apache.maven.scm + maven-scm-manager-plexus + 1.11.2 + + src/test/resources @@ -60,9 +72,45 @@ jacoco-maven-plugin 0.8.5 + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + 8 + + + + org.apache.maven.plugins + maven-site-plugin + 3.8.2 + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + true + false + release + deploy + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + org.apache.bcel + bcel + 6.4.1 + + + maven-compiler-plugin 3.8.1 @@ -292,7 +340,7 @@ jacoco - !jacoco.disabled + enable-jacoco @@ -385,6 +433,32 @@ + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.1.0 + + + + @@ -392,6 +466,10 @@ org.apache.maven.plugins maven-javadoc-plugin + + org.apache.maven.plugins + maven-project-info-reports-plugin + diff --git a/src/main/java/org/kohsuke/github/AbuseLimitHandler.java b/src/main/java/org/kohsuke/github/AbuseLimitHandler.java index 7d4d0e4b66..2c21cdaf9c 100644 --- a/src/main/java/org/kohsuke/github/AbuseLimitHandler.java +++ b/src/main/java/org/kohsuke/github/AbuseLimitHandler.java @@ -27,6 +27,7 @@ public abstract class AbuseLimitHandler { * this exception (or wrap this exception into another exception and throw it). * @param uc * Connection that resulted in an error. Useful for accessing other response headers. + * @throws IOException */ public abstract void onError(IOException e, HttpURLConnection uc) throws IOException; @@ -38,7 +39,7 @@ public abstract class AbuseLimitHandler { public void onError(IOException e, HttpURLConnection uc) throws IOException { try { Thread.sleep(parseWaitTime(uc)); - } catch (InterruptedException _) { + } catch (InterruptedException ex) { throw (InterruptedIOException)new InterruptedIOException().initCause(e); } } diff --git a/src/main/java/org/kohsuke/github/GHApp.java b/src/main/java/org/kohsuke/github/GHApp.java index 43ad91c5e0..d3a73354b2 100644 --- a/src/main/java/org/kohsuke/github/GHApp.java +++ b/src/main/java/org/kohsuke/github/GHApp.java @@ -104,6 +104,7 @@ public void setPermissions(Map permissions) { * You must use a JWT to access this endpoint. * * @see List installations + * @return a list of App installations */ @Preview @Deprecated public PagedIterable listInstallations() { diff --git a/src/main/java/org/kohsuke/github/GHProject.java b/src/main/java/org/kohsuke/github/GHProject.java index 6645a05a3e..66e347cbc3 100644 --- a/src/main/java/org/kohsuke/github/GHProject.java +++ b/src/main/java/org/kohsuke/github/GHProject.java @@ -32,7 +32,7 @@ /** * A GitHub project. - * @see https://developer.github.com/v3/projects/ + * @see Projects * @author Martin van Zijl */ public class GHProject extends GHObject { diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index b5922bc988..4fd57fde20 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -866,7 +866,7 @@ public GHHook getHook(int id) throws IOException { /** * Gets a comparison between 2 points in the repository. This would be similar - * to calling git log id1...id2 against a local repository. + * to calling git log id1...id2 against a local repository. * @param id1 an identifier for the first point to compare from, this can be a sha1 ID (for a commit, tag etc) or a direct tag name * @param id2 an identifier for the second point to compare to. Can be the same as the first point. * @return the comparison output @@ -928,7 +928,7 @@ public PagedIterable listRefs() throws IOException { /** * Retrieves all refs of the given type for the current GitHub repository. - * @param refType the type of reg to search for e.g. tags or commits + * @param refType the type of reg to search for e.g. tags or commits * @return an array of all refs matching the request type * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested */ @@ -939,7 +939,7 @@ public GHRef[] getRefs(String refType) throws IOException { /** * Retrieves all refs of the given type for the current GitHub repository. * - * @param refType the type of reg to search for e.g. tags or commits + * @param refType the type of reg to search for e.g. tags or commits * @return paged iterable of all refs of the specified type * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested */ diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index 0cbf425970..2d90ec0435 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -115,7 +115,7 @@ public class GitHub { * * @param apiUrl * The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or - * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. + * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. * For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated. * Password is also considered deprecated as it is no longer required for api usage. * @param login @@ -180,7 +180,7 @@ public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) * * @param apiUrl * The URL of GitHub (or GitHub Enterprise) API endpoint, such as "https://api.github.com" or - * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. + * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. * For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated. */ public static GitHub connectToEnterpriseWithOAuth(String apiUrl, String login, String oauthAccessToken) throws IOException { @@ -551,7 +551,7 @@ public Map getUserPublicOrganizations(GHUser user) throw * * To retrieve full organization details, you need to call {@link #getOrganization(String)} * - * @param user the user to retrieve public Organization membership information for + * @param login the user to retrieve public Organization membership information for * * @return the public Organization memberships for the user */ diff --git a/src/main/java/org/kohsuke/github/GitHubBuilder.java b/src/main/java/org/kohsuke/github/GitHubBuilder.java index f5e640c1a9..f0db8e609b 100644 --- a/src/main/java/org/kohsuke/github/GitHubBuilder.java +++ b/src/main/java/org/kohsuke/github/GitHubBuilder.java @@ -160,7 +160,7 @@ public static GitHubBuilder fromProperties(Properties props) { /** * @param endpoint * The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or - * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. + * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. * For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated. */ public GitHubBuilder withEndpoint(String endpoint) { diff --git a/src/test/java/org/kohsuke/github/GitHubStaticTest.java b/src/test/java/org/kohsuke/github/GitHubStaticTest.java index 793f23cc7c..9c03a3323b 100644 --- a/src/test/java/org/kohsuke/github/GitHubStaticTest.java +++ b/src/test/java/org/kohsuke/github/GitHubStaticTest.java @@ -26,6 +26,11 @@ public void timeRoundTrip() throws Exception { Date instantSeconds = Date.from(instantNow.truncatedTo(ChronoUnit.SECONDS)); Date instantMillis = Date.from(instantNow.truncatedTo(ChronoUnit.MILLIS)); + // if we happen to land exactly on zero milliseconds, add 1 milli + if (instantSeconds.equals(instantMillis)) { + instantMillis = Date.from(instantNow.plusMillis(1).truncatedTo(ChronoUnit.MILLIS)); + } + // TODO: other formats String instantFormatSlash = formatDate(instantMillis, "yyyy/MM/dd HH:mm:ss ZZZZ"); String instantFormatDash = formatDate(instantMillis, "yyyy-MM-dd'T'HH:mm:ss'Z'"); @@ -40,6 +45,7 @@ public void timeRoundTrip() throws Exception { assertThat(instantSeconds, equalTo(GitHub.parseDate(GitHub.printDate(instantSeconds)))); + // printDate will truncate to the nearest second, so it should not be equal assertThat(instantMillis, not(equalTo(GitHub.parseDate(GitHub.printDate(instantMillis))))); @@ -49,6 +55,7 @@ public void timeRoundTrip() throws Exception { assertThat(instantSeconds, equalTo(GitHub.parseDate(instantFormatDash))); + // This parser does not truncate to the nearest second, so it will be equal assertThat(instantMillis, equalTo(GitHub.parseDate(instantFormatMillis)));