Repository navigation
fix(#707): reduce the simple-no-file fix to the service entry and add a regression test (backport of #708) - #751
Merged
jbonofre merged 1 commit intoSep 7, 2026
Conversation
…sion test (backport of apache#708) The class the service entry points at is already shipped, unchanged, in the shaded camel-core-languages bundle, and Activator.BaseResolver loads it by name from that file -- the @language annotation is never read at runtime. The local copy of SimpleNoFileLanguage, the camel-api and camel-support dependencies it needed to compile, and the Export-Package narrowing those dependencies forced are therefore all unnecessary: - The local copy shadowed the upstream class in the shaded jar, so a future Camel change to SimpleNoFileLanguage would have been silently overridden with no build failure. - camel-api/camel-support were compile scope and, since the root pom sets createDependencyReducedPom=false, would have leaked into the published pom of the bundle and onto the classpath of every consumer. - Restoring the conventional org.apache.camel* export with those dependencies present makes bnd inline all of camel-api and camel-support into the bundle (412 KB -> 1.9 MB) and duplicate-export packages that core/camel-api and core/camel-support already provide. Replace the shade IncludeResourceTransformer with a <resource> entry: the module's <resources> block overrides Maven's default src/main/resources, which is why the file did not reach the bundle on its own. The transformer would also have hard-failed the build with "duplicate entry" if Apache Camel ever ships its own simple-no-file service file, whereas shade dedupes jar entries silently. Add the ASF licence header the file was missing; apache-rat rejected it, which breaks the release profile. java.util.Properties, used to parse the file, ignores the # comments. The resulting bundle is identical to the one built from main except for the added service entry, with an unchanged Export-Package. Add a Pax Exam regression test in tests/features/camel-core covering a pollEnrich with a dynamic file endpoint, the scenario reported in the issue. (cherry picked from commit 9d57b59)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #708 to
camel-karaf-4.18.x. Relates to #707.Why this is needed on top of #714
#714 already backported the first commit of #708 (
Added simple-no-file support, on this branch as e1caf2e). #708 was subsequently reworked, and that follow-up commit has not reached 4.18.x. This PR cherry-picks it (-x), bringing 4.18.x to the same final state asmain.What the follow-up commit changes
The service entry the fix relies on is loaded by name by
Activator.BaseResolver; the@Languageannotation on the class is never read at runtime. So the extra machinery that landed with #714 is unnecessary and actively harmful:SimpleNoFileLanguage— it shadowed the upstream class in the shaded jar, so a future Camel change toSimpleNoFileLanguagewould have been silently overridden with no build failure. The upstream class is already present and unchanged in the shaded bundle.camel-api/camel-supportdependencies the local copy needed to compile — they were compile scope and, because the root pom setscreateDependencyReducedPom=false, would have leaked into the bundle's published pom and onto every consumer's classpath.org.apache.camel*export → narrowed toorg.apache.camel.language*— keeping the wide export with those dependencies present makes bnd inline all of camel-api and camel-support into the bundle (412 KB → 1.9 MB) and duplicate-export packagescore/camel-apiandcore/camel-supportalready provide.IncludeResourceTransformerwith a<resource>entry — the module's<resources>block overrides Maven's defaultsrc/main/resources, which is why the file did not reach the bundle on its own. The transformer would also hard-fail the build withduplicate entryif Apache Camel ever ships its ownsimple-no-fileservice file, whereas the resource path lets shade dedupe silently.apache-ratrejected it, which breaks the release profile.java.util.Properties, used to parse the file, ignores the#comments. The header also carries a note recording why camel-karaf ships an entry Camel deliberately omits, so a future Camel upgrade does not drop it.tests/features/camel-coredriving apollEnrichwith a dynamic file endpoint — the scenario from simple-no-file language causes NoSuchLanguageException #707.Diff vs. #708
The tree of the touched paths is identical to the head of #708, apart from the
4.18.3-SNAPSHOTvs4.18.2-SNAPSHOTparent versions:The cherry-pick applied cleanly, with no conflicts.
Verification on this branch (JDK 17)
mvn install -pl tests/features/camel-core -am -DskipTests— BUILD SUCCESS; the new route supplier and itest compile against the 4.18.x test-support classes unchanged.camel-core-languagesbundle: 412 KB (not 1.9 MB),Export-Packagelimited toorg.apache.camel.language.*,SimpleNoFileLanguage.classpresent from the upstream shaded jar, and the service entry present with its header.apache-rat:check— 0 unapproved licences on both touched modules.mainin fix(#707): register the simple-no-file language in the camel-core-languages bundle #708, including that removing the service entry makestestCamelPollEnrichfail.AI-generated (Claude Code) on behalf of JB Onofré.