ammachado opened a new pull request, #23129:
URL: https://github.com/apache/camel/pull/23129

   
   # Description
   
   Two related changes to remove per-invocation plugin overhead from `camel`:
   
   * `CamelJBangMain.execute` now consults a new 
`PluginHelper.shouldDiscoverPlugins`
     gate before calling `addPlugins`. Built-in commands that do not consume 
plugins
     (e.g. `version`, `get`, `ps`, `stop`) short-circuit the plugin JSON read 
and
     FACTORY_FINDER classpath scan entirely. Plugin-consuming built-ins
     (`run`, `export`, `cmd`, `shell`), unknown subcommands (likely 
plugin-provided),
     and no-args/help still discover so plugin commands remain visible.
   
   * `PluginHelper.resolvePlugin` now reads a `resolved` block from the 
per-plugin
     entry in `~/.camel-jbang-plugins.json`. When present and valid (Camel 
version,
     gav, repos match; cached jars and the plugin POM unchanged by size+mtime), 
the
     plugin is loaded directly from a URLClassLoader over the cached jars, 
skipping
     FACTORY_FINDER and the Maven downloader. The resolved block is populated on
     the first successful Maven resolution; SNAPSHOT plugins rebuilt locally are
     picked up automatically via the mtime check.
   
   Tests cover the gate's classification, cache hit, mtime-based invalidation, 
the
   write path, and a paired before/after demonstration of the cache fast path
   (no resolved block -> resolver invoked and quits; resolved block present ->
   plugin loaded from the cached jar without invoking the resolver). The 
existing
   `testCacheInvalidatedOnMtimeChange` is cleaned up to use `assertThrows`
   instead of a try/empty-catch block.
   
   Upgrade guide updated.
   
   Co-Authored-By: Claude Opus 4.7 <[email protected]>
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   


-- 
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]

Reply via email to