Croway commented on code in PR #124: URL: https://github.com/apache/camel-upgrade-recipes/pull/124#discussion_r3841823583
########## camel-upgrade-recipes/src/main/resources/META-INF/rewrite/4.22.yaml: ########## @@ -0,0 +1,185 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +##### +# Rules coming from https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html +##### + +##### +# Update the Camel project from 4.21 to 4.22 +##### +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.CamelMigrationRecipe +displayName: Migrates `camel 4.21` application to `camel 4.22` +description: Migrates `camel 4.21` application to `camel 4.22`. +recipeList: + - org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes + - org.apache.camel.upgrade.camel422.migrateAwsApacheClient + - org.apache.camel.upgrade.camel422.migrateMinioTypes + - org.apache.camel.upgrade.camel422.removeCamelReactiveExecutorTomcatDependency + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsDependency + - org.apache.camel.upgrade.camel422.migrateOpenAiChatCompletion + - org.apache.camel.upgrade.camel422.migrateLangchain4jToolsUris + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsUris + - org.apache.camel.upgrade.camel422.migrateAtmosphereWebsocketHeaders +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-azure---component-specific-credentialtype-enums-removed +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes +displayName: Migrate Azure component-specific CredentialType enums to common enum +description: Migrates removed component-specific CredentialType enums to the shared org.apache.camel.component.azure.common.CredentialType enum. +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.cosmosdb.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventgrid.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventhubs.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.file.azure.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.functions.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.key.vault.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.servicebus.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.blob.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.datalake.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.queue.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-aws---migrated-from-apache-client-to-apache5-client +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAwsApacheClient +displayName: Migrate AWS SDK apache-client to apache5-client +description: Migrates software.amazon.awssdk:apache-client to software.amazon.awssdk:apache5-client. +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: Review Comment: Two issues: (1) no `ModuleHasDependency` gate on a camel-aws artifact, unlike the sibling minio/openai recipes, so any non-Camel project using the AWS SDK directly gets its HTTP client silently swapped; (2) no `newVersion`, so a pom pinning e.g. `apache-client:2.20.0` is rewritten to the nonexistent `apache5-client:2.20.0` (the artifact GA'd around 2.46.x) and the build breaks. Suggest gating on `org.apache.camel` / `camel-aws*`. _Claude Code on behalf of Federico Mariani_ ########## camel-spring-boot-upgrade-recipes/pom.xml: ########## @@ -76,6 +76,11 @@ <artifactId>rewrite-maven</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.openrewrite.recipe</groupId> + <artifactId>rewrite-java-dependencies</artifactId> + <scope>provided</scope> Review Comment: `rewrite-maven-plugin` does not resolve `provided`-scope transitives of a recipe artifact, so `ModuleHasDependency` is missing at end-user runtime and every recipe gated on it is skipped with a validation error. Reproduced against the released 4.21 artifact: `mvn org.openrewrite.maven:rewrite-maven-plugin:6.24.0:dryRun -Drewrite.recipeArtifactCoordinates=org.apache.camel.upgrade:camel-upgrade-recipes:4.21.0 -Drewrite.activeRecipes=org.apache.camel.upgrade.camel421.upgradeKafkaRecipes` → `Recipe validation error in org.openrewrite.java.dependencies.search.ModuleHasDependency: Recipe class ... cannot be found`. In-repo tests pass because the test classpath has the dep. Fix: use compile/runtime scope here and in `camel-upgrade-recipes/pom.xml` (rewrite-spring ships it at runtime scope for this reason). Pre-existing since 4.18, but this PR adds 4 more gated recipes. _Claude Code on behalf of Federico Mariani_ ########## camel-upgrade-recipes/src/main/resources/META-INF/rewrite/4.22.yaml: ########## @@ -0,0 +1,185 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +##### +# Rules coming from https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html +##### + +##### +# Update the Camel project from 4.21 to 4.22 +##### +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.CamelMigrationRecipe +displayName: Migrates `camel 4.21` application to `camel 4.22` +description: Migrates `camel 4.21` application to `camel 4.22`. +recipeList: + - org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes + - org.apache.camel.upgrade.camel422.migrateAwsApacheClient + - org.apache.camel.upgrade.camel422.migrateMinioTypes + - org.apache.camel.upgrade.camel422.removeCamelReactiveExecutorTomcatDependency + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsDependency + - org.apache.camel.upgrade.camel422.migrateOpenAiChatCompletion + - org.apache.camel.upgrade.camel422.migrateLangchain4jToolsUris + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsUris + - org.apache.camel.upgrade.camel422.migrateAtmosphereWebsocketHeaders +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-azure---component-specific-credentialtype-enums-removed +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes +displayName: Migrate Azure component-specific CredentialType enums to common enum +description: Migrates removed component-specific CredentialType enums to the shared org.apache.camel.component.azure.common.CredentialType enum. +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.cosmosdb.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventgrid.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventhubs.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.file.azure.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.functions.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.key.vault.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.servicebus.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.blob.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.datalake.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.queue.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-aws---migrated-from-apache-client-to-apache5-client +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAwsApacheClient +displayName: Migrate AWS SDK apache-client to apache5-client +description: Migrates software.amazon.awssdk:apache-client to software.amazon.awssdk:apache5-client. +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: software.amazon.awssdk + oldArtifactId: apache-client + newGroupId: software.amazon.awssdk + newArtifactId: apache5-client +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-minio---upgraded-to-minio-903---breaking-changes +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateMinioTypes +displayName: Migrate Minio types for minio 9.0 upgrade +description: Migrates Minio types that were renamed or moved in the minio 8.x to 9.0 upgrade. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-minio +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: io.minio.CopySource + newFullyQualifiedTypeName: io.minio.SourceObject +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-reactive-executor-tomcat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.removeCamelReactiveExecutorTomcatDependency +displayName: Remove camel-reactive-executor-tomcat dependency +description: Removes the camel-reactive-executor-tomcat dependency which was deprecated in Camel 4.22 (functionally identical to the built-in default reactive executor since JDK 17, Camel falls back to it automatically). +recipeList: + - org.openrewrite.maven.RemoveDependency: + groupId: org.apache.camel + artifactId: camel-reactive-executor-tomcat +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-spring-ai-chat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateSpringAiToolsDependency +displayName: Migrate camel-spring-ai-tools to camel-ai-tool +description: Migrates the camel-spring-ai-tools dependency, removed in Camel 4.22, to camel-ai-tool. Route URIs using the spring-ai-tools scheme must be migrated to ai-tool manually. +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: org.apache.camel + oldArtifactId: camel-spring-ai-tools + newGroupId: org.apache.camel + newArtifactId: camel-ai-tool + newVersion: 4.22.0 +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-openai +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateOpenAiChatCompletion +displayName: Migrate OpenAI ChatCompletion type to its new package +description: Migrates com.openai.models.ChatCompletion to com.openai.models.chat.completions.ChatCompletion, matching the javaType declared for the CamelOpenAIResponse exchange property since Camel 4.22. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-openai +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: com.openai.models.ChatCompletion + newFullyQualifiedTypeName: com.openai.models.chat.completions.ChatCompletion +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-langchain4j-tools-deprecated +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateLangchain4jToolsUris +displayName: Migrate langchain4j-tools endpoint URIs to ai-tool +description: Renames the langchain4j-tools URI scheme to ai-tool in Java, XML and YAML DSL routes. The camel-ai-tool dependency must be added manually, and direct tool-calling producer endpoints must be migrated to langchain4j-agent. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-langchain4j-tools +recipeList: + - org.apache.camel.upgrade.customRecipes.ChangeComponentUriRecipe: + uriPattern: "^langchain4j-tools:(.*)$" + replacement: "ai-tool:${1}" +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-spring-ai-chat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateSpringAiToolsUris +displayName: Migrate spring-ai-tools endpoint URIs to ai-tool +description: Renames the spring-ai-tools URI scheme to ai-tool in Java, XML and YAML DSL routes, following the removal of the camel-spring-ai-tools component. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-spring-ai-tools Review Comment: This precondition is self-defeating: `migrateSpringAiToolsDependency` (earlier in the same composite) renames `camel-spring-ai-tools` → `camel-ai-tool`, so the URI migration only works in a single fresh run. A user who already swapped the dependency manually (as the guide instructs) or re-runs on a partially migrated repo gets no URI migration, and `spring-ai-tools:` routes fail at startup on 4.22 where the component no longer exists. Suggest widening the gate to also match `camel-ai-tool`, or dropping it (the scheme is distinctive). _Claude Code on behalf of Federico Mariani_ ########## camel-upgrade-recipes/src/main/resources/META-INF/rewrite/4.22.yaml: ########## @@ -0,0 +1,185 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +##### +# Rules coming from https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html +##### + +##### +# Update the Camel project from 4.21 to 4.22 +##### +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.CamelMigrationRecipe +displayName: Migrates `camel 4.21` application to `camel 4.22` +description: Migrates `camel 4.21` application to `camel 4.22`. +recipeList: + - org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes + - org.apache.camel.upgrade.camel422.migrateAwsApacheClient + - org.apache.camel.upgrade.camel422.migrateMinioTypes + - org.apache.camel.upgrade.camel422.removeCamelReactiveExecutorTomcatDependency + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsDependency + - org.apache.camel.upgrade.camel422.migrateOpenAiChatCompletion + - org.apache.camel.upgrade.camel422.migrateLangchain4jToolsUris + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsUris + - org.apache.camel.upgrade.camel422.migrateAtmosphereWebsocketHeaders +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-azure---component-specific-credentialtype-enums-removed +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes +displayName: Migrate Azure component-specific CredentialType enums to common enum +description: Migrates removed component-specific CredentialType enums to the shared org.apache.camel.component.azure.common.CredentialType enum. +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.cosmosdb.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventgrid.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventhubs.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.file.azure.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.functions.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.key.vault.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.servicebus.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.blob.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.datalake.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.queue.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-aws---migrated-from-apache-client-to-apache5-client +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAwsApacheClient +displayName: Migrate AWS SDK apache-client to apache5-client +description: Migrates software.amazon.awssdk:apache-client to software.amazon.awssdk:apache5-client. +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: software.amazon.awssdk + oldArtifactId: apache-client + newGroupId: software.amazon.awssdk + newArtifactId: apache5-client +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-minio---upgraded-to-minio-903---breaking-changes +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateMinioTypes +displayName: Migrate Minio types for minio 9.0 upgrade +description: Migrates Minio types that were renamed or moved in the minio 8.x to 9.0 upgrade. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-minio +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: io.minio.CopySource + newFullyQualifiedTypeName: io.minio.SourceObject +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-reactive-executor-tomcat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.removeCamelReactiveExecutorTomcatDependency +displayName: Remove camel-reactive-executor-tomcat dependency +description: Removes the camel-reactive-executor-tomcat dependency which was deprecated in Camel 4.22 (functionally identical to the built-in default reactive executor since JDK 17, Camel falls back to it automatically). +recipeList: + - org.openrewrite.maven.RemoveDependency: + groupId: org.apache.camel + artifactId: camel-reactive-executor-tomcat +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-spring-ai-chat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateSpringAiToolsDependency +displayName: Migrate camel-spring-ai-tools to camel-ai-tool +description: Migrates the camel-spring-ai-tools dependency, removed in Camel 4.22, to camel-ai-tool. Route URIs using the spring-ai-tools scheme must be migrated to ai-tool manually. +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: org.apache.camel + oldArtifactId: camel-spring-ai-tools + newGroupId: org.apache.camel + newArtifactId: camel-ai-tool + newVersion: 4.22.0 +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-openai +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateOpenAiChatCompletion +displayName: Migrate OpenAI ChatCompletion type to its new package +description: Migrates com.openai.models.ChatCompletion to com.openai.models.chat.completions.ChatCompletion, matching the javaType declared for the CamelOpenAIResponse exchange property since Camel 4.22. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-openai +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: com.openai.models.ChatCompletion + newFullyQualifiedTypeName: com.openai.models.chat.completions.ChatCompletion +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-langchain4j-tools-deprecated +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateLangchain4jToolsUris +displayName: Migrate langchain4j-tools endpoint URIs to ai-tool +description: Renames the langchain4j-tools URI scheme to ai-tool in Java, XML and YAML DSL routes. The camel-ai-tool dependency must be added manually, and direct tool-calling producer endpoints must be migrated to langchain4j-agent. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-langchain4j-tools +recipeList: + - org.apache.camel.upgrade.customRecipes.ChangeComponentUriRecipe: + uriPattern: "^langchain4j-tools:(.*)$" Review Comment: This pattern rewrites **every** `langchain4j-tools:` literal, including producer/tool-calling `.to(...)` endpoints, which per the upgrade guide (and this recipe's own description) must become `langchain4j-agent:` instead. After the rewrite the user has a broken `ai-tool:` producer and has lost the `langchain4j-tools:` marker needed to find and hand-migrate it. The test only covers the `from(...)` consumer case. Suggest restricting the rewrite to consumer positions. Also, since the URIs are renamed but the `camel-ai-tool` dependency is not added, the migrated project fails at startup — consider pairing with `org.openrewrite.maven.AddDependency`. _Claude Code on behalf of Federico Mariani_ ########## camel-upgrade-recipes/src/main/resources/META-INF/rewrite/4.22.yaml: ########## @@ -0,0 +1,185 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +##### +# Rules coming from https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html +##### + +##### +# Update the Camel project from 4.21 to 4.22 +##### +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.CamelMigrationRecipe +displayName: Migrates `camel 4.21` application to `camel 4.22` +description: Migrates `camel 4.21` application to `camel 4.22`. +recipeList: + - org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes + - org.apache.camel.upgrade.camel422.migrateAwsApacheClient + - org.apache.camel.upgrade.camel422.migrateMinioTypes + - org.apache.camel.upgrade.camel422.removeCamelReactiveExecutorTomcatDependency + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsDependency + - org.apache.camel.upgrade.camel422.migrateOpenAiChatCompletion + - org.apache.camel.upgrade.camel422.migrateLangchain4jToolsUris + - org.apache.camel.upgrade.camel422.migrateSpringAiToolsUris + - org.apache.camel.upgrade.camel422.migrateAtmosphereWebsocketHeaders +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-azure---component-specific-credentialtype-enums-removed +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAzureCredentialTypes +displayName: Migrate Azure component-specific CredentialType enums to common enum +description: Migrates removed component-specific CredentialType enums to the shared org.apache.camel.component.azure.common.CredentialType enum. +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.cosmosdb.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventgrid.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.eventhubs.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.file.azure.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.functions.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.key.vault.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.servicebus.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.blob.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.datalake.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.apache.camel.component.azure.storage.queue.CredentialType + newFullyQualifiedTypeName: org.apache.camel.component.azure.common.CredentialType +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-aws---migrated-from-apache-client-to-apache5-client +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAwsApacheClient +displayName: Migrate AWS SDK apache-client to apache5-client +description: Migrates software.amazon.awssdk:apache-client to software.amazon.awssdk:apache5-client. +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: software.amazon.awssdk + oldArtifactId: apache-client + newGroupId: software.amazon.awssdk + newArtifactId: apache5-client +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-minio---upgraded-to-minio-903---breaking-changes +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateMinioTypes +displayName: Migrate Minio types for minio 9.0 upgrade +description: Migrates Minio types that were renamed or moved in the minio 8.x to 9.0 upgrade. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-minio +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: io.minio.CopySource + newFullyQualifiedTypeName: io.minio.SourceObject +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-reactive-executor-tomcat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.removeCamelReactiveExecutorTomcatDependency +displayName: Remove camel-reactive-executor-tomcat dependency +description: Removes the camel-reactive-executor-tomcat dependency which was deprecated in Camel 4.22 (functionally identical to the built-in default reactive executor since JDK 17, Camel falls back to it automatically). +recipeList: + - org.openrewrite.maven.RemoveDependency: + groupId: org.apache.camel + artifactId: camel-reactive-executor-tomcat +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-spring-ai-chat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateSpringAiToolsDependency +displayName: Migrate camel-spring-ai-tools to camel-ai-tool +description: Migrates the camel-spring-ai-tools dependency, removed in Camel 4.22, to camel-ai-tool. Route URIs using the spring-ai-tools scheme must be migrated to ai-tool manually. +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: org.apache.camel + oldArtifactId: camel-spring-ai-tools + newGroupId: org.apache.camel + newArtifactId: camel-ai-tool + newVersion: 4.22.0 +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-openai +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateOpenAiChatCompletion +displayName: Migrate OpenAI ChatCompletion type to its new package +description: Migrates com.openai.models.ChatCompletion to com.openai.models.chat.completions.ChatCompletion, matching the javaType declared for the CamelOpenAIResponse exchange property since Camel 4.22. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-openai +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: com.openai.models.ChatCompletion + newFullyQualifiedTypeName: com.openai.models.chat.completions.ChatCompletion +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-langchain4j-tools-deprecated +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateLangchain4jToolsUris +displayName: Migrate langchain4j-tools endpoint URIs to ai-tool +description: Renames the langchain4j-tools URI scheme to ai-tool in Java, XML and YAML DSL routes. The camel-ai-tool dependency must be added manually, and direct tool-calling producer endpoints must be migrated to langchain4j-agent. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-langchain4j-tools +recipeList: + - org.apache.camel.upgrade.customRecipes.ChangeComponentUriRecipe: + uriPattern: "^langchain4j-tools:(.*)$" + replacement: "ai-tool:${1}" +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-spring-ai-chat +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateSpringAiToolsUris +displayName: Migrate spring-ai-tools endpoint URIs to ai-tool +description: Renames the spring-ai-tools URI scheme to ai-tool in Java, XML and YAML DSL routes, following the removal of the camel-spring-ai-tools component. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-spring-ai-tools +recipeList: + - org.apache.camel.upgrade.customRecipes.ChangeComponentUriRecipe: + uriPattern: "^spring-ai-tools:(.*)$" + replacement: "ai-tool:${1}" +--- +## https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc#camel-atmosphere-websocket---potential-breaking-change +type: specs.openrewrite.org/v1beta/recipe +name: org.apache.camel.upgrade.camel422.migrateAtmosphereWebsocketHeaders +displayName: Migrate camel-atmosphere-websocket header values to new naming convention +description: Renames the atmosphere-websocket Exchange header string values from websocket.* to CamelAtmosphereWebsocket*, only when the camel-atmosphere-websocket dependency is present. Symbolic WebsocketConstants references are unaffected and need no migration. +preconditions: + - org.openrewrite.java.dependencies.search.ModuleHasDependency: + groupIdPattern: org.apache.camel + artifactIdPattern: camel-atmosphere-websocket +recipeList: + - org.apache.camel.upgrade.camel418_3.RenameHeaders: Review Comment: `RenameHeaders` → `RenameHeaderInJavaMethod` only matches `org.apache.camel.Message` `setHeader`/`getHeader` overloads, not the route DSL `ProcessorDefinition.setHeader(String, Expression)` — which is the upgrade guide's own before/after example (`from("direct:next").setHeader("websocket.connectionKey", header("myKey"))`). That form passes through unchanged and breaks at runtime on 4.22. The test only exercises `exchange.getIn().setHeader`, so the gap is invisible in CI. Suggest adding a `ProcessorDefinition.setHeader` matcher to `RenameHeaders`, or documenting the gap in the description and release notes. _Claude Code on behalf of Federico Mariani_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
