Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9840,14 +9840,28 @@ level (the `org.apache.cxf.services` loggers). The component no longer depends o
version when no version is given. It selects the newest release of the plugin built for the version of the CLI, from
the `camel.jbang.plugin.camel-versions` property in the POM of the plugin, or else from the version of its
`camel-jbang-core` dependency. The exact version is stored in `~/.camel-jbang-plugins.json`, so the plugin no longer
moves to newer releases on its own: run `camel plugin add <name>` again to select the newest matching release.
moves to newer releases on its own: run `camel plugin update` to select the newest matching release.
When the CLI is between the Camel versions of the releases, it selects the newest release for the nearest older Camel
version, with a warning. When the CLI is newer than all the releases, or the releases cannot be read, it warns and uses
`LATEST` as before.

`--version` and `--gav` are used as given, with a warning when the release is built for another Camel version. Plugins
registered before are not changed. See xref:camel-jbang-projects.adoc#_plugin_versions[Plugin versions].

=== camel-jbang - camel self-update updates the plugins

After installing a new Camel CLI, `camel self-update` runs `camel plugin update` with it. This updates
`~/.camel-jbang-plugins.json`: community plugins whose release `camel plugin add` selected move to the newest release
built for the new version, when the plugin has one.

A plugin may publish its release for a new Camel version some time after the Camel release. Until then,
`camel plugin update` keeps the current release and warns, and the CLI reminds to run it again when the plugin is loaded.

Plugins added with `--version` or `--gav`, the plugins of the Apache Camel project, and plugins added as `LATEST` are not
changed. Use `camel self-update --skip-plugins` to leave the plugins as they are. `camel self-update` of Camel CLI 4.23
and older does not update the plugins: run `camel plugin update` once after updating. See
xref:camel-jbang-projects.adoc#_updating_plugins[Updating plugins].

=== camel-spring - a CamelEvent only goes to the consumers of the same name

A `spring-event` producer publishes a body that is not an `ApplicationEvent` as a `CamelEvent`. Before, every
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ Once installed through `install.sh`/`install.ps1`, run:
camel self-update # install the latest release, if newer than what's running
camel self-update --version 4.23.0 # install a specific version (upgrade or downgrade)
camel self-update --check # report only, install nothing
camel self-update --skip-plugins # install the latest release, and leave the plugins as they are
----

`camel self-update` checks whether an update is actually needed first (no network cost for the
Expand All @@ -240,6 +241,20 @@ than re-implementing the download/verify/extract/activate steps a second time. T
script itself is downloaded fresh and verified against a SHA-256 published alongside it
(`install.sha256`) before it's run.

Once the new version is installed, `camel self-update` runs `camel plugin update` with it: a community plugin whose
release `camel plugin add` selected moves to the release built for the new version, when the plugin has one (see
xref:camel-jbang-projects.adoc#_updating_plugins[Updating plugins]). The new CLI selects the releases, as it is the one
that knows the Camel version it is built for. When the plugins cannot be updated (for example, a release cannot be
downloaded), `camel self-update` prints a hint to run `camel plugin update` later: the new CLI stays installed, and
`camel self-update` does not fail. `--skip-plugins` leaves the plugins as they are. When `camel self-update --check`
finds a newer version, it also reports what `camel plugin update` would change with it, without downloading the
plugins or changing anything.

Camel CLI 4.23 and older have no `camel plugin update`. When `camel self-update` installs one of them (for example
`--version 4.22.3`, or `--version LTS` while the newest LTS release is 4.22.x), it says so and leaves the plugins as they
are. `camel self-update` of Camel CLI 4.23 and older does not update the plugins either: after updating from such a
version, run `camel plugin update` once.

`camel self-update` refuses to run in two cases. If the currently running installation was not made
by `install.sh`/`install.ps1` (it was installed through Homebrew, Chocolatey, WinGet, Scoop,
SDKMAN, or JBang instead), the message names that manager and its own upgrade command, e.g.
Expand Down
70 changes: 62 additions & 8 deletions docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,14 @@ The plugins of the Apache Camel project are installed on first use: the first `c
The Camel CLI launcher, as installed by the install script or a package manager such as Homebrew, has kubernetes, test,
validate, tui and mcp in it, and downloads generate and edit from Maven Central the first time they are used.

Add, list installed, and remove plugins:
Add, list installed, update and remove plugins:

[source,bash]
----
camel plugin add generate
camel plugin add forage
camel plugin get
camel plugin update
camel plugin delete <plugin-name>
----

Expand All @@ -490,8 +491,9 @@ community plugin) can be loaded before it stores it: a name such as `kubernets`
similar name. Give `--gav` for a plugin of your own. A stored plugin that cannot be loaded no longer fails `camel run`
and `camel export`: they warn and go on without it. This includes a plugin built for another Camel version, whose
classes (or only those of its exporter or run customizer) do not link with this Camel CLI: the warning says so, and the
plugin's own command fails with the same reason. Run `camel plugin add <plugin-name>` to select a release built for
this Camel version, or remove the plugin with `camel plugin delete <plugin-name>`.
plugin's own command fails with the same reason. Run `camel plugin update <plugin-name>` to select the release built
for this Camel version (or `camel plugin add <plugin-name>` for a plugin whose release `camel plugin add` did not select,
see <<Updating plugins>>), or remove the plugin with `camel plugin delete <plugin-name>`.

=== Custom plugin configuration

Expand All @@ -517,7 +519,7 @@ camel plugin get

The resolution order is: `--plugin-config` option > `CAMEL_CLI_PLUGIN_CONFIG` environment variable > default `~/.camel-jbang-plugins.json`.

NOTE: The `--plugin-config` option only applies to the `plugin` subcommands (`add`, `get`, `delete`, `list`).
NOTE: The `--plugin-config` option only applies to the `plugin` subcommands (`add`, `get`, `delete`, `list`, `update`).
Running a plugin's own command (e.g. `camel kubernetes ...`) discovers plugins only through the environment variable or the default file.
So a plugin added with `camel plugin add --plugin-config X` is not seen unless `CAMEL_CLI_PLUGIN_CONFIG` is also set.

Expand Down Expand Up @@ -553,10 +555,11 @@ A SNAPSHOT build of the CLI is compared without `-SNAPSHOT`. The `--camel-versio
this: it is the version of the installed CLI that counts.

`camel plugin add` downloads the selected release before it saves the configuration, and stores the exact version in
`~/.camel-jbang-plugins.json`, together with the Camel versions it supports. The plugin therefore stays at that version:
run `camel plugin add <name>` again to select the newest matching release, for example after a new patch release of the
plugin. When the CLI is upgraded to a Camel version that the stored release does not support, the CLI warns when the
plugin is loaded, and tells to run `camel plugin add <name>` again. Plugins added with an older CLI are not checked.
`~/.camel-jbang-plugins.json`, together with the Camel versions it supports. The plugin therefore stays at that version
until `camel plugin update` selects the newest matching release, for example after a new patch release of the plugin
(see <<Updating plugins>>). `camel self-update` runs it after installing a new version of the CLI. When the CLI is a
Camel version that the stored release does not support, the CLI warns when the plugin is loaded, and tells to run
`camel plugin update <name>`. Plugins added with an older CLI are not checked.

The CLI selects the newest release of the first line that supports its version. When no release read supports it:

Expand Down Expand Up @@ -590,6 +593,57 @@ For example, Forage 1.4.2 is built for Camel 4.18:
camel plugin add forage --gav io.kaoto.forage:camel-jbang-plugin-forage:1.4.2
----

=== Updating plugins

`camel plugin update` selects the release of the plugins again, for the version of the installed CLI, as
`camel plugin add` does (see <<Plugin versions>>), and changes a plugin when another release is selected: a new patch
release of the plugin, or the release built for the Camel version of a new CLI. `camel plugin update <name>` updates one
plugin.

[source,bash]
----
$ camel plugin update
forage 1.6.2 -> 1.7.0 (built for Camel 4.23.0)
kit 0.4.0 is kept: camel plugin add did not select this release (such as one given with --version or --gav)
----

The selected release is downloaded before the configuration is saved: when it cannot be downloaded, the plugin keeps its
release, and the command exits with code `1`. A plugin already on the selected release is left as it is, a release
built for the CLI is never replaced by an older one, and the configuration file is only written when a plugin changes.

Only the plugins whose release `camel plugin add` selected (it stores the Camel versions the release supports) are
changed. The other plugins are reported, and kept as they are:

* a plugin added with `--version` or `--gav` stays at that release
* a plugin of the Apache Camel project always uses the version of the CLI
* a plugin added as `LATEST`, by an older CLI or when `camel plugin add` could not select a release: run
`camel plugin add <name>` to select the release built for the CLI

A plugin may publish its release for a new Camel version some time after the Camel release. Until then, when the CLI is
newer than the Camel versions of all the releases of the plugin, `camel plugin update` keeps the current release (a
release built for another Camel version gains nothing) and warns, and the CLI reminds to run `camel plugin update`
again each time the plugin is loaded:

[source,bash]
----
$ camel plugin update forage
WARN: No release of forage is built for Camel CLI 4.24.0 yet (the newest, 1.7.0, is built for Camel 4.23.0). Keeping forage 1.6.2: run 'camel plugin update forage' again once a release built for this Camel version is published.
----

When the releases cannot be read (for example, when offline), or the CLI is older than the Camel versions of all the
releases, `camel plugin update` warns and keeps the plugin as it is too. When the CLI is between the Camel versions of
the releases, it selects the newest release for the nearest older Camel version, and warns, as `camel plugin add` does.

A plugin added with `--version`, as the warnings suggest to use one of the releases found, is not updated any more:
`camel plugin update` and `camel self-update` keep that version. To select the releases again, add the plugin again
without `--version`: `camel plugin add <name>` for a known community plugin, or with its `--groupId` and `--artifactId`
(and `--repo`, if any) for another one.

`camel plugin update --dry-run` reports what would change, without downloading the plugins or changing anything.

`camel self-update` runs `camel plugin update` with the new CLI once it is installed, see
xref:camel-jbang-launcher-install.adoc#_upgrading_and_switching_versions[Upgrading and switching versions].

=== Building custom plugins

It is possible to build custom Camel CLI plugins. We suggest to take a look at one of the https://github.com/apache/camel/tree/main/dsl/camel-jbang[existing plugins],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

// AUTO-GENERATED by camel-package-maven-plugin - DO NOT EDIT THIS FILE
= camel plugin update

Update the community plugins to the releases built for this Camel CLI


== Usage

[source,bash]
----
camel plugin update [options]
----



== Options

[cols="2,5,1,2",options="header"]
|===
| Option | Description | Default | Type
| `--dry-run` | Report what would change, without downloading the plugins or changing anything | | boolean
| `--plugin-config` | Path to a custom plugin configuration file or directory. Only applies to the plugin subcommands; for plugin commands themselves (e.g. 'camel kubernetes'), set CAMEL_CLI_PLUGIN_CONFIG instead. | | String
| `-h,--help` | Display this help and exit | | boolean
|===


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ camel plugin [options]
| xref:jbang-commands/camel-jbang-plugin-delete.adoc[delete] | Removes a plugin
| xref:jbang-commands/camel-jbang-plugin-get.adoc[get] | Get installed plugins
| xref:jbang-commands/camel-jbang-plugin-list.adoc[list] | List all available plugins
| xref:jbang-commands/camel-jbang-plugin-update.adoc[update] | Update the community plugins to the releases built for this Camel CLI
|===


Expand Down
Loading
Loading