[
https://issues.apache.org/jira/browse/CAMEL-24862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117631#comment-18117631
]
Claus Ibsen commented on CAMEL-24862:
-------------------------------------
Corrected after reproducing: a Java class added at the top of the source
directory IS compiled on the reload and usable within seconds. What failed in
the benchmark was the class under src/main/java/camel/example: the file watcher
registers the directory tree once at start
(FileWatcherResourceReloadStrategy.registerRecursive), the JDK watch service
only reports events for registered directories, and a new directory arrives as
one create event on its parent that the watch task skips. So every file under a
directory created after the start was never seen. Second finding on the way:
the class files the runtime writes into the compile work dir
(.camel-jbang/compile) are inside the watched tree and, with the * pattern,
trigger a reload of their own. Both fixed in the PR: a directory created under
a watched one is registered as it appears (recursive mode) with its files
handled as changes, and the compile work dir is ignored.
> camel-core - the recursive file watcher does not watch a directory created
> while it runs (a Java class added under src/main/java is never reloaded), and
> reloads on its own compile output
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24862
> URL: https://issues.apache.org/jira/browse/CAMEL-24862
> Project: Camel
> Issue Type: Improvement
> Components: camel-core, camel-jbang
> Reporter: Claus Ibsen
> Priority: Major
>
> Found by the stepwise half of the round-2 local-model benchmark (ten
> camel-jbang-examples built step by step through the camel-jbang-mcp server,
> five runs each, 2026-09-21).
> With {{camel run --source-dir=. --dev}} running a YAML route, adding
> {{OrderNumber.java}} and a {{beans.yaml}} that declares it as a bean, and
> referencing the bean from the route, ends in "No bean could be found in the
> registry for: orderNumber" and "class camel.example.OrderNumber was not
> found" on every reload; a restart of the same command line loads it fine. The
> reload compiles nothing new; only a restart does. Dev mode should compile a
> new (or changed) Java class in the source directory on reload, the way it
> reloads a changed route file, or the reload error should say that a new Java
> class needs a restart.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)