From ddf25c3bc4f79c8da607e89ca793f49e41fc3a96 Mon Sep 17 00:00:00 2001 From: "jonathan.vila" Date: Tue, 3 Dec 2024 17:17:17 +0100 Subject: [PATCH 1/3] fix: uses safe Boolean check instead of error prone unboxing Signed-off-by: jonathan.vila --- .../eclipse/jkube/maven/plugin/mojo/build/ResourceMojo.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/ResourceMojo.java b/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/ResourceMojo.java index 5fab601cdf..1b1b50e71c 100644 --- a/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/ResourceMojo.java +++ b/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/ResourceMojo.java @@ -178,12 +178,12 @@ protected ResourceClassifier getResourceClassifier() { private void validateIfRequired(File resourceDir, ResourceClassifier classifier) throws MojoExecutionException, MojoFailureException { try { - if (!skipResourceValidation) { + if (Boolean.FALSE.equals(skipResourceValidation)) { log.verbose("Validating resources"); new ResourceValidator(resourceDir, classifier, log).validate(); } } catch (ConstraintViolationException e) { - if (failOnValidationError) { + if (Boolean.TRUE.equals(failOnValidationError)) { log.error("[[R]]" + e.getMessage() + "[[R]]"); log.error("[[R]]use \"mvn -Djkube.skipResourceValidation=true\" option to skip the validation[[R]]"); throw new MojoFailureException("Failed to generate kubernetes descriptor"); @@ -191,7 +191,7 @@ private void validateIfRequired(File resourceDir, ResourceClassifier classifier) log.warn("[[Y]]" + e.getMessage() + "[[Y]]"); } } catch (Exception e) { - if (failOnValidationError) { + if (Boolean.TRUE.equals(failOnValidationError)) { throw new MojoExecutionException("Failed to validate resources", e); } else { log.warn("Failed to validate resources: %s", e.getMessage()); From 1a6bb3676343d1d85664543e96e4e7c50e6bee0a Mon Sep 17 00:00:00 2001 From: "jonathan.vila" Date: Tue, 3 Dec 2024 17:22:07 +0100 Subject: [PATCH 2/3] fix: rename variable to not hide variable Signed-off-by: jonathan.vila --- .../jkube/maven/plugin/mojo/develop/RemoteDevMojoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/RemoteDevMojoTest.java b/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/RemoteDevMojoTest.java index 0220019b27..efcc8ec6c0 100644 --- a/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/RemoteDevMojoTest.java +++ b/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/RemoteDevMojoTest.java @@ -84,6 +84,6 @@ void execute_withException_shouldStop() throws Exception { // Then assertThat(remoteDevelopmentService.constructed()) .singleElement() - .satisfies(remoteDevelopmentService -> verify(remoteDevelopmentService, times(1)).stop()); + .satisfies(service -> verify(service, times(1)).stop()); } } From 164c198302efe786b02b6f971206755228fbad71 Mon Sep 17 00:00:00 2001 From: "jonathan.vila" Date: Tue, 3 Dec 2024 17:22:35 +0100 Subject: [PATCH 3/3] fix: remove commented line Signed-off-by: jonathan.vila --- .../jkube/maven/plugin/mojo/develop/UndeployMojoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/UndeployMojoTest.java b/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/UndeployMojoTest.java index 6dc76e6f0d..92faa13a68 100644 --- a/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/UndeployMojoTest.java +++ b/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/UndeployMojoTest.java @@ -71,7 +71,7 @@ void setUp() throws IOException { .log(new KitLogger.SilentLogger()) .platformMode(RuntimeMode.KUBERNETES) .build(); -// log = new KitLogger.SilentLogger(); + mojoExecution = new MojoExecution(new MojoDescriptor()); mojoExecution.getMojoDescriptor().setPluginDescriptor(new PluginDescriptor()); mojoExecution.getMojoDescriptor().getPluginDescriptor().setGoalPrefix("k8s");