From 9d3269ee981534a6a16158e138fdecd011507b15 Mon Sep 17 00:00:00 2001 From: Daniel Flower Date: Sat, 21 Dec 2024 14:07:03 +0800 Subject: [PATCH] Revert "Handle plugin dependencies" This reverts commit 8177ccd2a36202ae5510d85d43885d46d0b8468f. --- .../mavenplugins/release/PomUpdater.java | 5 +- src/site/markdown/changelog.md | 1 - src/test/java/e2e/PluginDependencyTest.java | 70 ------------ src/test/java/scaffolding/TestProject.java | 25 ++--- .../.gitignore | 6 - .../openapi-spec-as-plugin-dependency/pom.xml | 43 -------- .../the-openapi-spec/pom.xml | 37 ------- .../src/main/resources/openapi-spec.yaml | 58 ---------- .../schemas/openapi-common-error-types.yaml | 68 ------------ .../schemas/openapi-common-types.yaml | 22 ---- .../resources/schemas/openapi-errors.yaml | 25 ----- .../the-service-impl/pom.xml | 104 ------------------ .../OpenApiController.java | 20 ---- 13 files changed, 11 insertions(+), 473 deletions(-) delete mode 100644 src/test/java/e2e/PluginDependencyTest.java delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/.gitignore delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/pom.xml delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/pom.xml delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/openapi-spec.yaml delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-error-types.yaml delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-types.yaml delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-errors.yaml delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/the-service-impl/pom.xml delete mode 100644 test-projects/openapi-spec-as-plugin-dependency/the-service-impl/src/main/java/com/github/danielflower/mavenplugins/testprojects/openapispecasplugindependency/OpenApiController.java diff --git a/src/main/java/com/github/danielflower/mavenplugins/release/PomUpdater.java b/src/main/java/com/github/danielflower/mavenplugins/release/PomUpdater.java index 36d50ba5..cdb8ca1e 100644 --- a/src/main/java/com/github/danielflower/mavenplugins/release/PomUpdater.java +++ b/src/main/java/com/github/danielflower/mavenplugins/release/PomUpdater.java @@ -104,9 +104,6 @@ private List alterModel(MavenProject project, String newVersion) { if (originalModel.getBuild() != null && originalModel.getBuild().getPlugins() != null) { for (Plugin plugin : originalModel.getBuild().getPlugins()) { alterSinglePlugin(errors, searchingFrom, projectProperties, plugin); - for (Dependency dependency : plugin.getDependencies()) { - alterSingleDependency(errors, searchingFrom, projectProperties, dependency); - } } } @@ -128,7 +125,7 @@ private List alterModel(MavenProject project, String newVersion) { } return errors; } - + private boolean isReleasablePlugin(Plugin plugin) { try { reactor.find(plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion()); diff --git a/src/site/markdown/changelog.md b/src/site/markdown/changelog.md index 8e49c12c..2cb828ec 100644 --- a/src/site/markdown/changelog.md +++ b/src/site/markdown/changelog.md @@ -4,7 +4,6 @@ Changelog ### 3.6.0 * Latest tagged version from current branch is used for unchanged modules [issue #118 for details](https://github.com/danielflower/multi-module-maven-release-plugin/issues/118) -* Handle plugin dependencies the same way as "ordinary" dependencies (update version number) ### 3.2.0 diff --git a/src/test/java/e2e/PluginDependencyTest.java b/src/test/java/e2e/PluginDependencyTest.java deleted file mode 100644 index bf06863d..00000000 --- a/src/test/java/e2e/PluginDependencyTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package e2e; - -import org.junit.BeforeClass; -import org.junit.Test; -import scaffolding.MvnRunner; -import scaffolding.TestProject; - -import java.util.List; - -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static scaffolding.ExactCountMatcher.oneOf; -import static scaffolding.GitMatchers.hasTag; - -public class PluginDependencyTest { - - final TestProject testProject = TestProject.openapiSpecAsPluginDependency(); - - - @BeforeClass - public static void installPluginToLocalRepo() { - MvnRunner.installReleasePluginToLocalRepo(); - } - - @Test - public void runWithPluginDependencyWithoutCommitInOpenApiSpecShouldSucceed() throws Exception { - List output1 = testProject.mvnRelease("1", "-X"); - assertThat( - output1, - allOf( - // Make sure that plugin uses the-openapi-spec 1.0.1 - oneOf(containsString("Populating class realm plugin>org.openapitools:openapi-generator-maven-plugin")), - oneOf(containsString("Included: com.github.danielflower.mavenplugins.testprojects.openapi-spec-as-plugin-dependency:the-openapi-spec:jar:1.0.1")) - ) - ); - testProject.commitRandomFile("the-openapi-spec").pushIt(); - List output2 = testProject.mvnRelease("2", "-X"); - assertThat( - output2, - allOf( - // Make sure that plugin uses the-openapi-spec 1.0.2 - oneOf(containsString("Populating class realm plugin>org.openapitools:openapi-generator-maven-plugin")), - oneOf(containsString("Included: com.github.danielflower.mavenplugins.testprojects.openapi-spec-as-plugin-dependency:the-openapi-spec:jar:1.0.2")) - ) - ); - - // The module in which a new file was committed - assertTagExists("the-openapi-spec-1.0.1"); - assertTagExists("the-openapi-spec-1.0.2"); - - // The module in which the module "the-openapi-spec" is used - assertTagExists("the-service-impl-1.0.1"); - assertTagExists("the-service-impl-1.0.2"); - - // The parent module - assertTagExists("openapi-spec-as-plugin-dependency-aggregator-1.0.1"); - assertTagDoesNotExist("openapi-spec-as-plugin-dependency-aggregator-1.0.2"); - } - - private void assertTagExists(String tagName) { - assertThat(testProject.local, hasTag(tagName)); - assertThat(testProject.origin, hasTag(tagName)); - } - - private void assertTagDoesNotExist(String tagName) { - assertThat(testProject.local, not(hasTag(tagName))); - assertThat(testProject.origin, not(hasTag(tagName))); - } - -} diff --git a/src/test/java/scaffolding/TestProject.java b/src/test/java/scaffolding/TestProject.java index 49ce3937..e89f6fe7 100644 --- a/src/test/java/scaffolding/TestProject.java +++ b/src/test/java/scaffolding/TestProject.java @@ -50,15 +50,15 @@ public void setMvnOpts(String mavenOpts) { public List mvnRelease(String buildNumber) throws IOException, InterruptedException { return mvnRunner.runMaven(localDir, - "-DbuildNumber=" + buildNumber, - "releaser:release"); + "-DbuildNumber=" + buildNumber, + "releaser:release"); } - public List mvnRelease(String buildNumber, String... arguments) throws IOException, InterruptedException { + public List mvnRelease(String buildNumber, String...arguments) throws IOException, InterruptedException { return mvnRun("releaser:release", buildNumber, arguments); } - public List mvnReleaserNext(String buildNumber, String... arguments) throws IOException, InterruptedException { + public List mvnReleaserNext(String buildNumber, String...arguments) throws IOException, InterruptedException { return mvnRun("releaser:next", buildNumber, arguments); } @@ -93,7 +93,7 @@ private List mvnRun(String goal, String buildNumber, String[] arguments) String[] args = new String[arguments.length + 2]; args[0] = "-DbuildNumber=" + buildNumber; System.arraycopy(arguments, 0, args, 1, arguments.length); - args[args.length - 1] = goal; + args[args.length-1] = goal; return mvnRunner.runMaven(localDir, args); } @@ -111,10 +111,10 @@ private static TestProject project(String name) { File localDir = Photocopier.folderForSampleProject(name); Git local = Git.cloneRepository() - .setBare(false) - .setDirectory(localDir) - .setURI(originDir.toURI().toString()) - .call(); + .setBare(false) + .setDirectory(localDir) + .setURI(originDir.toURI().toString()) + .call(); return new TestProject(originDir, origin, localDir, local); } catch (Exception e) { @@ -186,7 +186,7 @@ public static TestProject dependencyManagementProject() { } public static TestProject dependencyManagementUsingParentModuleVersionPropertyProject() { - return project("dependencymanagement-using-parent-module-version-property"); + return project("dependencymanagement-using-parent-module-version-property"); } public static TestProject moduleWithTestFailure() { @@ -196,7 +196,6 @@ public static TestProject moduleWithTestFailure() { public static TestProject moduleWithSnapshotDependencies() { return project("snapshot-dependencies"); } - public static TestProject moduleWithSnapshotDependenciesWithVersionProperties() { return project("snapshot-dependencies-with-version-properties"); } @@ -205,10 +204,6 @@ public static TestProject differentDelimiterProject() { return project("different-delimiter"); } - public static TestProject openapiSpecAsPluginDependency() { - return project("openapi-spec-as-plugin-dependency"); - } - public void setMvnRunner(MvnRunner mvnRunner) { this.mvnRunner = mvnRunner; } diff --git a/test-projects/openapi-spec-as-plugin-dependency/.gitignore b/test-projects/openapi-spec-as-plugin-dependency/.gitignore deleted file mode 100644 index e2bcab56..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -target -.idea/ -*.iml -.classpath -.settings -.project diff --git a/test-projects/openapi-spec-as-plugin-dependency/pom.xml b/test-projects/openapi-spec-as-plugin-dependency/pom.xml deleted file mode 100644 index b55187ce..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - 4.0.0 - - - org.springframework.boot - spring-boot-starter-parent - 3.3.4 - - - - com.github.danielflower.mavenplugins.testprojects.openapi-spec-as-plugin-dependency - openapi-spec-as-plugin-dependency-aggregator - 1.0-SNAPSHOT - - - 1.8 - 1.8 - - - the-openapi-spec - the-service-impl - - pom - - - - - com.github.danielflower.mavenplugins - multi-module-maven-release-plugin - ${current.plugin.version} - - - install - - - - - - diff --git a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/pom.xml b/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/pom.xml deleted file mode 100644 index 37948f0c..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - 4.0.0 - - - com.github.danielflower.mavenplugins.testprojects.openapi-spec-as-plugin-dependency - openapi-spec-as-plugin-dependency-aggregator - 1.0-SNAPSHOT - - - the-openapi-spec - 1.0-SNAPSHOT - jar - - - 1.8 - 1.8 - - - - - - com.github.danielflower.mavenplugins - multi-module-maven-release-plugin - ${current.plugin.version} - - - install - - - - - - diff --git a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/openapi-spec.yaml b/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/openapi-spec.yaml deleted file mode 100644 index 898d39e4..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/openapi-spec.yaml +++ /dev/null @@ -1,58 +0,0 @@ -openapi: 3.0.3 -info: - title: Openapi Spec As Plugin dependency test - description: | - Some dummy specification - version: 1.0.0 - contact: - name: Michael Saladin - email: noreply@notexist.ch - license: - name: All rights reserved by multi-module-maven-release-plugin - url: https://github.com/danielflower/multi-module-maven-release-plugin -servers: - - url: 'http://localhost:8080/api' -tags: - - name: Dummy - description: Dummy operations -components: - securitySchemes: - basicAuth: - description: | - No description - type: http - scheme: basic - bearerAuth: - description: | - No description - type: http - scheme: bearer - bearerFormat: JWT -security: - - basicAuth: [ ] - - bearerAuth: [ ] - -paths: - /fee/ping: - get: - tags: - - Ping - summary: Unauthenticated ping service - description: Returns a ping result. - operationId: ping - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: 'schemas/openapi-common-types.yaml#/components/schemas/PingResult' - '400': - description: | - Client Error. - content: - application/json: - schema: - $ref: 'schemas/openapi-common-error-types.yaml#/components/schemas/Fault' - '500': - $ref: 'schemas/openapi-errors.yaml#/components/responses/500_Response' diff --git a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-error-types.yaml b/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-error-types.yaml deleted file mode 100644 index 9174966c..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-error-types.yaml +++ /dev/null @@ -1,68 +0,0 @@ -openapi: 3.0.3 -info: - title: Openapi Common Error types - description: 'Error types, that can be used across all applications' - version: 1.0.2 - license: - name: All rights reserved by multi-module-maven-release-plugin -paths: { } -components: - schemas: - Fault: - description: Generic Fault. - type: object - required: - - errors - properties: - errors: - type: array - items: - $ref: "#/components/schemas/Error" - Error: - description: Generic Error. - type: object - required: - - id - - status - - message - properties: - id: - description: UUID for log analyses (to trace back calls to the JFA server), should be logged by the caller - type: string - status: - description: The HTTP status code associated with this Error - type: integer - minimum: 100 - maximum: 999 - message: - description: Non-translated exception message, meant for logging. - type: string - code: - description: | - Optional code, to further specify the cause. - Possible values are to be defined per usage of the Fault. - type: string - transferId: - description: The transferId received in the request. - type: string - correlationId: - description: The correlationId received in the request. - type: string - translations: - description: | - Optional, map for translated messages, which can directly be used to show to the user (UI). - Key is an ISO 2 locale eg. "de", "en", "fr", "it" etc. - type: object - additionalProperties: - type: string - messageKey: - description: | - Optional, a message key to translate the error on client side (together with 'params'). - type: string - params: - description: | - Optional, generic map for cases, where additional informations are to be returned. - Expected params are to defined per usage of the Fault. - type: object - additionalProperties: - type: string diff --git a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-types.yaml b/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-types.yaml deleted file mode 100644 index 141c7874..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-common-types.yaml +++ /dev/null @@ -1,22 +0,0 @@ -openapi: 3.0.3 -info: - title: Openapi common types - description: | - No description - version: 1.0.0 - license: - name: All rights reserved by multi-module-maven-release-plugin -paths: { } -components: - schemas: - PingResult: - description: | - Service responds with a timestamp, not meant to be parsed or used in any way. - type: object - required: - - timestamp - properties: - timestamp: - type: string - format: date-time - diff --git a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-errors.yaml b/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-errors.yaml deleted file mode 100644 index 53cbb20e..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/the-openapi-spec/src/main/resources/schemas/openapi-errors.yaml +++ /dev/null @@ -1,25 +0,0 @@ -openapi: 3.0.3 -info: - title: Fee Service errors - version: 1.0.0 - license: - name: All rights reserved by multi-module-maven-release-plugin - -paths: { } - -components: - - # Response-Error definitions - responses: - 500_Response: - description: | - Internal Server Error - content: - application/json: - schema: - $ref: 'openapi-common-error-types.yaml#/components/schemas/Fault' - example: - errors: - - id: '6629232743873699088' - status: 500 - message: Internal server error diff --git a/test-projects/openapi-spec-as-plugin-dependency/the-service-impl/pom.xml b/test-projects/openapi-spec-as-plugin-dependency/the-service-impl/pom.xml deleted file mode 100644 index 99fafe31..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/the-service-impl/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - 4.0.0 - - - com.github.danielflower.mavenplugins.testprojects.openapi-spec-as-plugin-dependency - openapi-spec-as-plugin-dependency-aggregator - 1.0-SNAPSHOT - - - the-service-impl - 1.0-SNAPSHOT - jar - - - 1.8 - 1.8 - - - - - com.github.danielflower.mavenplugins.testprojects.openapi-spec-as-plugin-dependency - the-openapi-spec - 1.0-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-web - - - io.swagger.core.v3 - swagger-annotations - 2.2.20 - - - jakarta.validation - jakarta.validation-api - 3.0.2 - - - org.openapitools - jackson-databind-nullable - 0.2.6 - - - - - - - com.github.danielflower.mavenplugins - multi-module-maven-release-plugin - ${current.plugin.version} - - - install - - - - - org.openapitools - openapi-generator-maven-plugin - 7.8.0 - - - com.github.danielflower.mavenplugins.testprojects.openapi-spec-as-plugin-dependency - the-openapi-spec - 1.0-SNAPSHOT - - - - - - generate - - - openapi-spec.yaml - spring - com.github.danielflower.mavenplugins.tesetprojects.openapispecasplugindependency.facade.openapi.api - com.github.danielflower.mavenplugins.tesetprojects.openapispecasplugindependency.facade.openapi.model - false - false - false - - true - java8 - true - true - true - true - true - true - true - true - - - - - - - - diff --git a/test-projects/openapi-spec-as-plugin-dependency/the-service-impl/src/main/java/com/github/danielflower/mavenplugins/testprojects/openapispecasplugindependency/OpenApiController.java b/test-projects/openapi-spec-as-plugin-dependency/the-service-impl/src/main/java/com/github/danielflower/mavenplugins/testprojects/openapispecasplugindependency/OpenApiController.java deleted file mode 100644 index b9d05e2e..00000000 --- a/test-projects/openapi-spec-as-plugin-dependency/the-service-impl/src/main/java/com/github/danielflower/mavenplugins/testprojects/openapispecasplugindependency/OpenApiController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.github.danielflower.mavenplugins.testprojects.versioninheritor; - -import com.github.danielflower.mavenplugins.tesetprojects.openapispecasplugindependency.facade.openapi.api.PingApi; -import com.github.danielflower.mavenplugins.tesetprojects.openapispecasplugindependency.facade.openapi.model.PingResult; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import java.time.OffsetDateTime; -import org.springframework.http.ResponseEntity; - -@RestController -@RequestMapping("/api") -public class OpenApiController implements PingApi { - - @Override - public ResponseEntity ping() { - var result = new PingResult(OffsetDateTime.now()); - return ResponseEntity.ok(result); - } - -}