From cebe1bcb2241a2997df60d2a62e65f75a34a4c3c Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Thu, 25 Sep 2025 06:00:38 -0400 Subject: [PATCH] Make project friendlier for Eclipse IDE development - use maven-resources-plugin/copy-resources instead of referencing resources outside of module project directories - provide generic argument type hints in several locations in the topic operator's `TypeHandler` Signed-off-by: Michael Edgar --- cluster-operator/pom.xml | 26 ++++++++++--- development-docs/DEV_GUIDE.md | 10 +++-- systemtest/pom.xml | 38 +++++++++++++------ .../strimzi/operator/topic/KafkaHandler.java | 24 ++++++------ 4 files changed, 64 insertions(+), 34 deletions(-) diff --git a/cluster-operator/pom.xml b/cluster-operator/pom.xml index ff7ecb54fb0..6643fe5b036 100644 --- a/cluster-operator/pom.xml +++ b/cluster-operator/pom.xml @@ -283,6 +283,26 @@ org.apache.maven.plugins maven-resources-plugin ${maven.resources.version} + + + copy-kafka-versions + generate-resources + + copy-resources + + + ${project.build.outputDirectory} + + + ${strimziRootDirectory} + + kafka-versions.yaml + + + + + + org.apache.maven.plugins @@ -365,12 +385,6 @@ src/main/resources-filtered true - - .. - - kafka-versions.yaml - - diff --git a/development-docs/DEV_GUIDE.md b/development-docs/DEV_GUIDE.md index 002def2027b..46bb5ca5fd0 100644 --- a/development-docs/DEV_GUIDE.md +++ b/development-docs/DEV_GUIDE.md @@ -8,6 +8,7 @@ This document gives a detailed breakdown of the various build processes and opti - [Build Pre-Requisites](#build-pre-requisites) - [Using an IDE](#using-an-ide) - [IntelliJ IDEA](#intellij-idea) + - [Eclipse](#eclipse) - [IDE build problems](#ide-build-problems) - [Build and deploy Strimzi from source](#build-and-deploy-from-source) - [Build details](#build-details) @@ -21,7 +22,7 @@ This document gives a detailed breakdown of the various build processes and opti - [Helm Chart](#helm-chart) - [Running system tests](#running-system-tests) - [DCO Signoff](#dco-signoff) -- [Building container images for other platforms with Docker `buildx`](#building-container-images-for-other-platforms-with-docker-buildx) +- [Building container images for other platforms](#building-container-images-for-other-platforms) @@ -110,6 +111,10 @@ Afterwards IntelliJ should no longer have any `Cannot resolve symbol` errors. Note: After running the Maven build in the terminal you might need to [reload the project](https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html#maven_reimport) from the Maven tool window. +### Eclipse +* Eclipse users may find the [m2e-apt plugin](https://marketplace.eclipse.org/content/m2e-apt) useful for the automatic +configuration of Eclipse projects for annotation processing. + ### IDE build problems The build also uses a Java annotation processor. Some IDEs (such as IntelliJ's IDEA) by default don't run the annotation @@ -117,9 +122,6 @@ processor in their build process. You can run `mvn clean install -DskipTests` to as part of the `maven` build, and the IDE should then be able to use the generated classes. It is also possible to configure the IDE to run the annotation processor directly. -Eclipse users may find the [m2e-apt plugin](https://marketplace.eclipse.org/content/m2e-apt) useful for the automatic -configuration of Eclipse projects for annotation processing. - ## Build and deploy from source To build Strimzi from a source the operator and Kafka code needs to be compiled into container images and placed diff --git a/systemtest/pom.xml b/systemtest/pom.xml index a947a50d1a9..32ca3269798 100644 --- a/systemtest/pom.xml +++ b/systemtest/pom.xml @@ -269,6 +269,32 @@ + + org.apache.maven.plugins + maven-resources-plugin + ${maven.resources.version} + + + copy-kafka-versions + generate-resources + + copy-resources + + + ${project.build.outputDirectory} + + + ${strimziRootDirectory} + + kafka-versions.yaml + bridge.version + + + + + + + org.apache.maven.plugins maven-javadoc-plugin @@ -329,18 +355,6 @@ - - - src/main/resources - - - .. - - kafka-versions.yaml - bridge.version - - - diff --git a/topic-operator/src/main/java/io/strimzi/operator/topic/KafkaHandler.java b/topic-operator/src/main/java/io/strimzi/operator/topic/KafkaHandler.java index fc0a1917505..e64d4f80511 100644 --- a/topic-operator/src/main/java/io/strimzi/operator/topic/KafkaHandler.java +++ b/topic-operator/src/main/java/io/strimzi/operator/topic/KafkaHandler.java @@ -142,20 +142,20 @@ public PartitionedByError createTopics(List { if (newTopicsErrors.containsKey(reconcilableTopic)) { - return new Pair<>(reconcilableTopic, Either.ofLeft(newTopicsErrors.get(reconcilableTopic))); + return new Pair<>(reconcilableTopic, Either.ofLeft(newTopicsErrors.get(reconcilableTopic))); } try { values.get(reconcilableTopic.topicName()).get(); - return new Pair<>(reconcilableTopic, Either.ofRight( - new TopicState(new TopicDescription(reconcilableTopic.topicName(), + return new Pair<>(reconcilableTopic, Either.ofRight( + new TopicState(new TopicDescription(reconcilableTopic.topicName(), false, List.of(), Set.of(), ctr.topicId(reconcilableTopic.topicName()).get()), null) )); } catch (ExecutionException e) { if (e.getCause() != null && e.getCause() instanceof TopicExistsException) { // we treat this as a success, the next reconciliation checks the configuration - return new Pair<>(reconcilableTopic, Either.ofRight(null)); + return new Pair<>(reconcilableTopic, Either.ofRight(null)); } else { - return new Pair<>(reconcilableTopic, Either.ofLeft(handleAdminException(e))); + return new Pair<>(reconcilableTopic, Either.ofLeft(handleAdminException(e))); } } catch (InterruptedException e) { throw new UncheckedInterruptedException(e); @@ -247,9 +247,9 @@ public PartitionedByError alterConfigs(List>> entryStream = someAlterConfigs.stream().map(entry -> { try { - return new Pair<>(entry.getKey(), Either.ofRight(alterConfigsResult.get(buildTopicConfigResource(entry.getKey().topicName())).get())); + return new Pair<>(entry.getKey(), Either.ofRight(alterConfigsResult.get(buildTopicConfigResource(entry.getKey().topicName())).get())); } catch (ExecutionException e) { - return new Pair<>(entry.getKey(), Either.ofLeft(handleAdminException(e))); + return new Pair<>(entry.getKey(), Either.ofLeft(handleAdminException(e))); } catch (InterruptedException e) { throw new UncheckedInterruptedException(e); } @@ -359,9 +359,9 @@ public PartitionedByError describeTopics(List(reconcilableTopic, Either.ofLeft(handleAdminException(exception))); + return new Pair<>(reconcilableTopic, Either.ofLeft(handleAdminException(exception))); } else { - return new Pair<>(reconcilableTopic, Either.ofRight(new TopicState(description, configs))); + return new Pair<>(reconcilableTopic, Either.ofRight(new TopicState(description, configs))); } })); } @@ -398,12 +398,12 @@ public PartitionedByError deleteTopics(List { try { futuresMap.get(reconcilableTopic.topicName()).get(); - return new Pair<>(reconcilableTopic, Either.ofRight(null)); + return new Pair<>(reconcilableTopic, Either.ofRight(null)); } catch (ExecutionException e) { if (e.getCause() instanceof UnknownTopicOrPartitionException) { - return new Pair<>(reconcilableTopic, Either.ofRight(null)); + return new Pair<>(reconcilableTopic, Either.ofRight(null)); } else { - return new Pair<>(reconcilableTopic, Either.ofLeft(handleAdminException(e))); + return new Pair<>(reconcilableTopic, Either.ofLeft(handleAdminException(e))); } } catch (InterruptedException e) { throw new UncheckedInterruptedException(e);