From d1a0c25fb596963018bee7317d66915bcc882530 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Wed, 8 May 2024 14:08:05 +0200 Subject: [PATCH] refactor: remove unused component Signed-off-by: Marc Nuri --- .../maven/plugin/mojo/build/AbstractDockerMojo.java | 8 -------- .../jkube/maven/plugin/mojo/build/ResourceMojo.java | 4 ---- .../src/main/resources/META-INF/plexus/components.xml | 9 ++------- .../jkube/maven/plugin/mojo/develop/WatchMojoTest.java | 2 -- .../src/main/resources/META-INF/plexus/components.xml | 9 ++------- .../plugin/mojo/build/OpenShiftResourceMojoTest.java | 8 -------- 6 files changed, 4 insertions(+), 36 deletions(-) diff --git a/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java b/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java index 20c0143892..542e9bd4bd 100644 --- a/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java +++ b/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java @@ -33,10 +33,8 @@ import org.eclipse.jkube.kit.build.service.docker.DockerServiceHub; import org.eclipse.jkube.kit.build.service.docker.access.DockerAccess; import org.eclipse.jkube.kit.build.service.docker.auth.AuthConfigFactory; -import org.eclipse.jkube.kit.build.api.helper.ConfigHelper; import org.eclipse.jkube.kit.build.service.docker.config.DockerMachineConfiguration; import org.eclipse.jkube.kit.config.image.WatchMode; -import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver; import org.eclipse.jkube.kit.common.JavaProject; import org.eclipse.jkube.kit.common.KitLogger; import org.eclipse.jkube.kit.common.util.AnsiLogger; @@ -199,10 +197,6 @@ public abstract class AbstractDockerMojo extends AbstractMojo @Parameter(property = "jkube.profile") protected String profile; - // Handler for external configurations - @Component - protected ImageConfigResolver imageConfigResolver; - /** * Skip extended authentication */ @@ -377,7 +371,6 @@ public final void execute() throws MojoExecutionException, MojoFailureException protected void init() { log = new AnsiLogger(getLog(), useColorForLogging(), verbose, !settings.getInteractiveMode(), getLogPrefix()); authConfigFactory = new AuthConfigFactory(log); - imageConfigResolver.setLog(log); clusterAccess = new ClusterAccess(initClusterConfiguration()); runtimeMode = getConfiguredRuntimeMode(); } @@ -429,7 +422,6 @@ protected void doExecute() throws MojoExecutionException { protected abstract void executeInternal() throws IOException, MojoExecutionException; protected JKubeConfiguration initJKubeConfiguration() throws DependencyResolutionRequiredException { - ConfigHelper.validateExternalPropertyActivation(javaProject, images); return JKubeConfiguration.builder() .project(MavenUtil.convertMavenProjectToJKubeProject(project, session)) .sourceDirectory(sourceDirectory) 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 c1d4110b72..116cb4656d 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 @@ -22,7 +22,6 @@ import javax.validation.ConstraintViolationException; import org.eclipse.jkube.generator.api.GeneratorContext; -import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver; import org.eclipse.jkube.generator.api.DefaultGeneratorManager; import org.eclipse.jkube.kit.common.KitLogger; @@ -69,9 +68,6 @@ public class ResourceMojo extends AbstractJKubeMojo { // Filename for holding the build timestamp public static final String DOCKER_BUILD_TIMESTAMP = "docker/build.timestamp"; - @Component - protected ImageConfigResolver imageConfigResolver; - /** * Should we use the project's compile-time classpath to scan for additional enrichers/generators? */ diff --git a/kubernetes-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml b/kubernetes-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml index 4f4fa91b2b..1fa21ba0ed 100644 --- a/kubernetes-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml +++ b/kubernetes-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml @@ -91,8 +91,8 @@ - org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler - org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler + org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler + org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler false @@ -132,10 +132,5 @@ org.eclipse.jkube.kit.build.service.docker.DockerAccessFactory false - - org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver - org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver - false - diff --git a/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/WatchMojoTest.java b/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/WatchMojoTest.java index 038b9d42c8..9e36a6ce0d 100644 --- a/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/WatchMojoTest.java +++ b/kubernetes-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/develop/WatchMojoTest.java @@ -22,7 +22,6 @@ import java.util.Properties; import io.fabric8.kubernetes.client.KubernetesClient; -import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver; import org.eclipse.jkube.kit.common.JKubeConfiguration; import org.eclipse.jkube.kit.common.JavaProject; import org.eclipse.jkube.kit.config.access.ClusterAccess; @@ -95,7 +94,6 @@ void setUp(@TempDir Path temporaryFolder) throws Exception { settings = mavenSettings; kubernetesManifest = kubernetesManifestFile; resourceDir = temporaryFolder.resolve("src").resolve("main").resolve("jkube").toFile().getAbsoluteFile(); - imageConfigResolver = new ImageConfigResolver(); buildStrategy = JKubeBuildStrategy.jib; setPluginContext(new HashMap<>()); }}; diff --git a/openshift-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml b/openshift-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml index 4f4fa91b2b..1fa21ba0ed 100644 --- a/openshift-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml +++ b/openshift-maven-plugin/plugin/src/main/resources/META-INF/plexus/components.xml @@ -91,8 +91,8 @@ - org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler - org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler + org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler + org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler false @@ -132,10 +132,5 @@ org.eclipse.jkube.kit.build.service.docker.DockerAccessFactory false - - org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver - org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver - false - diff --git a/openshift-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/build/OpenShiftResourceMojoTest.java b/openshift-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/build/OpenShiftResourceMojoTest.java index da6cc3384a..0f27187b3c 100644 --- a/openshift-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/build/OpenShiftResourceMojoTest.java +++ b/openshift-maven-plugin/plugin/src/test/java/org/eclipse/jkube/maven/plugin/mojo/build/OpenShiftResourceMojoTest.java @@ -21,7 +21,6 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; import org.apache.maven.settings.Settings; -import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver; import org.eclipse.jkube.kit.common.KitLogger; import org.eclipse.jkube.kit.config.access.ClusterConfiguration; import org.eclipse.jkube.kit.config.image.ImageConfiguration; @@ -35,13 +34,10 @@ import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; class OpenShiftResourceMojoTest { @@ -105,8 +101,6 @@ void executeInternal_resolvesGroupInImageNameToClusterAccessNamespace_whenNamesp .build()) .build(); resourceMojo.images = Collections.singletonList(imageConfiguration); - resourceMojo.imageConfigResolver = mock(ImageConfigResolver.class); - when(resourceMojo.imageConfigResolver.resolve(eq(imageConfiguration), any())).thenReturn(Collections.singletonList(imageConfiguration)); resourceMojo.access = ClusterConfiguration.builder().namespace("namespace-from-cluster-access").build(); // When resourceMojo.execute(); @@ -126,8 +120,6 @@ void execute_resolvesGroupInImageNameToNamespaceSetViaConfiguration_whenNoNamesp .build()) .build(); resourceMojo.images = Collections.singletonList(imageConfiguration); - resourceMojo.imageConfigResolver = mock(ImageConfigResolver.class); - when(resourceMojo.imageConfigResolver.resolve(eq(imageConfiguration), any())).thenReturn(Collections.singletonList(imageConfiguration)); resourceMojo.namespace = "namespace-configured-via-plugin"; // When resourceMojo.execute();