From add17d8a756c4602d62991e499a611999d0082eb Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 03:50:13 +0100 Subject: [PATCH 01/11] Update Jenkinsfile Try to experiment with trying to get javadocs jar and sources jar uploaded --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f3a8538..8a42bfb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,6 +37,9 @@ pipeline { filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" + echo "${filesByGlob[1].name} ${filesByGlob[1].path} ${filesByGlob[1].directory} ${filesByGlob[1].length} ${filesByGlob[1].lastModified}" + echo "${filesByGlob[2].name} ${filesByGlob[2].path} ${filesByGlob[2].directory} ${filesByGlob[2].length} ${filesByGlob[2].lastModified}" + artifactPath = filesByGlob[0].path; artifactExists = fileExists artifactPath; From a8503a264144316cdf2f8284fe33417ab7e250bf Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 04:11:18 +0100 Subject: [PATCH 02/11] Update Jenkinsfile Try to upload 3 jar files and pom.xml --- Jenkinsfile | 59 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a42bfb..6f69ea1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,35 +40,42 @@ pipeline { echo "${filesByGlob[1].name} ${filesByGlob[1].path} ${filesByGlob[1].directory} ${filesByGlob[1].length} ${filesByGlob[1].lastModified}" echo "${filesByGlob[2].name} ${filesByGlob[2].path} ${filesByGlob[2].directory} ${filesByGlob[2].length} ${filesByGlob[2].lastModified}" + javadocsArtifact = filesByGlob[0].path; + jarWithSourcesArtifact = filesByGlob[1].path; + jarArtifact = filesByGlob[2].path; - artifactPath = filesByGlob[0].path; - artifactExists = fileExists artifactPath; - - if (artifactExists) { - echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + when { + allOf { + expression { + return fileExists javadocsArtifact + } + expression { + return fileExists jarWithSourcesArtifact + } + expression { + return fileExists jarArtifact + } + } + } - nexusArtifactUploader( - nexusVersion: NEXUS_VERSION, - protocol: NEXUS_PROTOCOL, - nexusUrl: NEXUS_URL, - groupId: pom.groupId, - version: pom.version, - repository: NEXUS_REPOSITORY, - credentialsId: NEXUS_CREDENTIAL_ID, - artifacts: [ - [artifactId: pom.artifactId, - classifier: '', - file: artifactPath, - type: pom.packaging], + echo "*** File: ${javadocsArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + echo "*** File: ${jarWithSourcesArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + echo "*** File: ${jarArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - [artifactId: pom.artifactId, - classifier: '', - file: "pom.xml", - type: "pom"] - ] - ) - } else { - error "*** File: ${artifactPath}, could not be found"; + nexusArtifactUploader( + nexusVersion: NEXUS_VERSION, + protocol: NEXUS_PROTOCOL, + nexusUrl: NEXUS_URL, + groupId: pom.groupId, + version: pom.version, + repository: NEXUS_REPOSITORY, + credentialsId: NEXUS_CREDENTIAL_ID, + artifacts: [ + [artifactId: pom.artifactId, classifier: 'normal', file: jarArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"] + ]) } } } From d4782842cb4bbd01d5567611fd93e9001d933af8 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 04:12:45 +0100 Subject: [PATCH 03/11] Update Jenkinsfile Try to fix compilation errors --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6f69ea1..c16fe0c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,13 +47,13 @@ pipeline { when { allOf { expression { - return fileExists javadocsArtifact + return fileExists(javadocsArtifact) } expression { - return fileExists jarWithSourcesArtifact + return fileExists(jarWithSourcesArtifact) } expression { - return fileExists jarArtifact + return fileExists(jarArtifact) } } } From 8e51c55300a19511171268b95b34ab2a629508e5 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 04:14:22 +0100 Subject: [PATCH 04/11] Update Jenkinsfile Try to fix compilation errors --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c16fe0c..965cbc9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,8 +75,8 @@ pipeline { [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"] - ]) - } + ] + ) } } } From 6faf7483777c4904faf847acfba82a776180dd80 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 04:18:00 +0100 Subject: [PATCH 05/11] Update Jenkinsfile Revert to simple if condition check --- Jenkinsfile | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 965cbc9..39140cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,25 +58,29 @@ pipeline { } } - echo "*** File: ${javadocsArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - echo "*** File: ${jarWithSourcesArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - echo "*** File: ${jarArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + if (fileExists(javadocsArtifact) && fileExists(jarWithSourcesArtifact) && fileExists(jarArtifact)) { + echo "*** File: ${javadocsArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + echo "*** File: ${jarWithSourcesArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + echo "*** File: ${jarArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - nexusArtifactUploader( - nexusVersion: NEXUS_VERSION, - protocol: NEXUS_PROTOCOL, - nexusUrl: NEXUS_URL, - groupId: pom.groupId, - version: pom.version, - repository: NEXUS_REPOSITORY, - credentialsId: NEXUS_CREDENTIAL_ID, - artifacts: [ - [artifactId: pom.artifactId, classifier: 'normal', file: jarArtifact, type: pom.packaging], - [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], - [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], - [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"] - ] - ) + nexusArtifactUploader( + nexusVersion: NEXUS_VERSION, + protocol: NEXUS_PROTOCOL, + nexusUrl: NEXUS_URL, + groupId: pom.groupId, + version: pom.version, + repository: NEXUS_REPOSITORY, + credentialsId: NEXUS_CREDENTIAL_ID, + artifacts: [ + [artifactId: pom.artifactId, classifier: 'normal', file: jarArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"] + ] + ) + } else { + error "*** Files could not be found"; + } } } } From fb73bd1b7e7ec25c4d11b47215990bfb96220e25 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 04:18:15 +0100 Subject: [PATCH 06/11] Update Jenkinsfile Remove when() --- Jenkinsfile | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 39140cf..2683625 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,20 +44,6 @@ pipeline { jarWithSourcesArtifact = filesByGlob[1].path; jarArtifact = filesByGlob[2].path; - when { - allOf { - expression { - return fileExists(javadocsArtifact) - } - expression { - return fileExists(jarWithSourcesArtifact) - } - expression { - return fileExists(jarArtifact) - } - } - } - if (fileExists(javadocsArtifact) && fileExists(jarWithSourcesArtifact) && fileExists(jarArtifact)) { echo "*** File: ${javadocsArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; echo "*** File: ${jarWithSourcesArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; From f81fb2b9318f8b4197d5a97a5d9688ba8ecd7822 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 04:41:22 +0100 Subject: [PATCH 07/11] Make MyWaifuClient.java public --- src/main/java/org/goudham/me/MyWaifuClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/goudham/me/MyWaifuClient.java b/src/main/java/org/goudham/me/MyWaifuClient.java index 2dae6d8..271e0b8 100644 --- a/src/main/java/org/goudham/me/MyWaifuClient.java +++ b/src/main/java/org/goudham/me/MyWaifuClient.java @@ -27,7 +27,7 @@ public class MyWaifuClient { *

See MyWaifuList for obtaining an API Key

* @param apiKey API Key to authorise API request */ - MyWaifuClient(@NotNull String apiKey) { + public MyWaifuClient(@NotNull String apiKey) { myWaifuWrapper = new MyWaifuWrapper(apiKey); } From 42e9ce4439b8af4ccf04314fcf1e999123978a55 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 14:13:33 +0100 Subject: [PATCH 08/11] Make MyWaifuWrapper.java package private To ensure that the downstream client/user cannot instantiate an instance of MyWaifuWrapper, it has been moved into the same package as MyWaifuClient --- src/main/java/org/goudham/me/MyWaifuClient.java | 1 - src/main/java/org/goudham/me/{api => }/MyWaifuWrapper.java | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) rename src/main/java/org/goudham/me/{api => }/MyWaifuWrapper.java (82%) diff --git a/src/main/java/org/goudham/me/MyWaifuClient.java b/src/main/java/org/goudham/me/MyWaifuClient.java index 271e0b8..bc174e3 100644 --- a/src/main/java/org/goudham/me/MyWaifuClient.java +++ b/src/main/java/org/goudham/me/MyWaifuClient.java @@ -1,6 +1,5 @@ package org.goudham.me; -import org.goudham.me.api.MyWaifuWrapper; import org.jetbrains.annotations.NotNull; import javax.net.ssl.SSLParameters; diff --git a/src/main/java/org/goudham/me/api/MyWaifuWrapper.java b/src/main/java/org/goudham/me/MyWaifuWrapper.java similarity index 82% rename from src/main/java/org/goudham/me/api/MyWaifuWrapper.java rename to src/main/java/org/goudham/me/MyWaifuWrapper.java index 58b8494..0a208f4 100644 --- a/src/main/java/org/goudham/me/api/MyWaifuWrapper.java +++ b/src/main/java/org/goudham/me/MyWaifuWrapper.java @@ -1,11 +1,9 @@ -package org.goudham.me.api; - -import org.goudham.me.MyWaifuClient; +package org.goudham.me; /** * Returns API information to {@link MyWaifuClient} */ -public class MyWaifuWrapper { +class MyWaifuWrapper { private final String version = "1.0"; private final String host = "https://mywaifulist.moe/api/v1/"; private final String apiKey; From 303083ff4bbb260c6fff46599d642ee25473e7ca Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 16:20:25 +0100 Subject: [PATCH 09/11] Make MyWaifuWrapper.java constructor private Ensures that users/clients are not able to instantiate an instance of MyWaifuWrapper.java --- src/main/java/org/goudham/me/MyWaifuWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/goudham/me/MyWaifuWrapper.java b/src/main/java/org/goudham/me/MyWaifuWrapper.java index 0a208f4..f116755 100644 --- a/src/main/java/org/goudham/me/MyWaifuWrapper.java +++ b/src/main/java/org/goudham/me/MyWaifuWrapper.java @@ -12,7 +12,7 @@ class MyWaifuWrapper { * Instantiates an instance of {@link MyWaifuWrapper} to retrieve API Information * @param apiKey API Key to authorise API request */ - public MyWaifuWrapper(String apiKey) { + MyWaifuWrapper(String apiKey) { this.apiKey = apiKey; } } From f58ba047a3b7e6749cd5ed561a6b6a8ad7d7cbf2 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 16:33:45 +0100 Subject: [PATCH 10/11] Update Jenkinsfile Make sure that the main jar does not have an additional classifier to mention within pom.xml's --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2683625..796e2c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,7 +58,7 @@ pipeline { repository: NEXUS_REPOSITORY, credentialsId: NEXUS_CREDENTIAL_ID, artifacts: [ - [artifactId: pom.artifactId, classifier: 'normal', file: jarArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: '', file: jarArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"] From 3c8a6d56607c428345f4e3ff8234322ce0d272f1 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 16:50:11 +0100 Subject: [PATCH 11/11] Update Jenkinsfile Add new classifier 'core' back in because it was not working without a classifier --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 796e2c1..94692d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,7 +58,7 @@ pipeline { repository: NEXUS_REPOSITORY, credentialsId: NEXUS_CREDENTIAL_ID, artifacts: [ - [artifactId: pom.artifactId, classifier: '', file: jarArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: 'core', file: jarArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"]