This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new b6100d4fd319 CAMEL-27005: camel-launcher - the generate plugin
installs on first use instead of being bundled (#30163)
b6100d4fd319 is described below
commit b6100d4fd319c66a82c0594f10fe8373b6fb3125
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 16 18:15:19 2026 +0100
CAMEL-27005: camel-launcher - the generate plugin installs on first use
instead of being bundled (#30163)
The Camel CLI launcher no longer bundles the generate plugin and the
OpenAPI generator it uses, a fifth of the download (bin.tar.gz from 113 MB to
91 MB, 342 to 284 JARs). camel generate installs the plugin on first use from
Maven Central, as camel edit does. The docs list the plugins the launcher
bundles, and the 4.24 upgrade guide has a note.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 8 ++++++++
.../modules/ROOT/pages/camel-jbang-projects.adoc | 4 +++-
dsl/camel-jbang/camel-launcher/pom.xml | 19 ++++++-------------
.../camel/dsl/jbang/launcher/CamelLauncherMain.java | 7 +++----
.../camel/dsl/jbang/launcher/CamelLauncherTest.java | 16 ++++++++++++++--
5 files changed, 34 insertions(+), 20 deletions(-)
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 9e397bf219ab..186aaa4d41ac 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -9295,6 +9295,14 @@ could not start, such as with Docker down, was gone
without a word. Now:
The output of the service goes to `~/.camel/<pid>-run.log`, instead of a pipe
that nobody read. `camel infra stop`
removes it.
+=== camel-launcher - the generate plugin installs on first use
+
+The Camel CLI launcher, as installed by the install script or a package
manager such as Homebrew, no longer has the
+generate plugin in it: the plugin and the OpenAPI generator it uses are about
24 MB, a fifth of the download. The first
+`camel generate` downloads the plugin from Maven Central into the local Maven
repository, and adds it to the plugin
+configuration, as for `camel edit`. To have it on a machine that is offline
later, run `camel generate --help` once
+while it is online.
+
=== camel-jbang - camel run loads one version of each library
`camel run` downloads the JARs of each component when it is first used. It now
keeps one version of each library: when
diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
b/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
index b4726c459479..eb89693b176d 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
@@ -267,7 +267,9 @@ The plugins of the Apache Camel project:
| edit | `camel edit`: edit a Camel file in the terminal with suggestions and
diagnostics
|===
-Plugins bundled with the CLI, such as `tui`, are installed on first use.
+The plugins of the Apache Camel project are installed on first use: the first
`camel tui` installs the tui plugin.
+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:
diff --git a/dsl/camel-jbang/camel-launcher/pom.xml
b/dsl/camel-jbang/camel-launcher/pom.xml
index 53d57d511143..00d9327ca77b 100644
--- a/dsl/camel-jbang/camel-launcher/pom.xml
+++ b/dsl/camel-jbang/camel-launcher/pom.xml
@@ -67,13 +67,10 @@
<dependencyManagement>
<dependencies>
<!--
- This launcher bundles both camel-jbang-plugin-generate and
camel-jbang-plugin-tui on a
- single flat classpath. The generate plugin drags in commonmark
0.21.0 (via openapi-generator),
- while the tui plugin (via tamboui-markdown) needs commonmark
0.28.0 and its renderer.markdown
- classes that do not exist in 0.21.0. Without this pin Maven
mediation keeps the older 0.21.0
- core next to the 0.28.0 extensions, which makes the TUI
Markdown help throw NoClassDefFoundError.
- Pin the core to 0.28.0 so it matches the commonmark-ext-*
modules; openapi-generator only uses
- the stable Parser/HtmlRenderer APIs, which are unchanged in
0.28.0.
+ The tui plugin (via tamboui-markdown) needs a commonmark core
that is not older than its
+ commonmark-ext-* modules. The generate plugin, which installs
on first use, brings commonmark 0.21.0,
+ but its class loader asks the launcher first, so it uses this
core too; openapi-generator only uses
+ the stable Parser/HtmlRenderer APIs.
-->
<dependency>
<groupId>org.commonmark</groupId>
@@ -124,12 +121,8 @@
</dependency>
<!-- Pre-installed plugins -->
- <!-- the edit plugin is not pre-installed -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jbang-plugin-generate</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!-- the edit and generate plugins are not pre-installed: they install
on first use
+ (generate and its OpenAPI generator are about 24 MB, a fifth of
the download) -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jbang-plugin-test</artifactId>
diff --git
a/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherMain.java
b/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherMain.java
index cac15903e344..7e05d9bf9e24 100644
---
a/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherMain.java
+++
b/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherMain.java
@@ -25,7 +25,6 @@ import java.util.Set;
import java.util.function.Supplier;
import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
-import org.apache.camel.dsl.jbang.core.commands.generate.GeneratePlugin;
import org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesPlugin;
import org.apache.camel.dsl.jbang.core.commands.mcp.McpPlugin;
import org.apache.camel.dsl.jbang.core.commands.test.TestPlugin;
@@ -46,12 +45,12 @@ public class CamelLauncherMain extends CamelJBangMain {
private record EmbeddedPlugin(Supplier<Plugin> factory, Set<String>
commands) {
}
- // Lambdas, not constructor references (GeneratePlugin::new): a
constructor reference loads its class when this list
- // is created, so every command would load all the plugins (and the test
plugin loads Citrus and picocli). Their
+ // Lambdas, not constructor references (KubernetesPlugin::new): a
constructor reference loads its class when this
+ // list is created, so every command would load all the plugins (and the
test plugin loads Citrus and picocli). Their
// JARs are far down the class path of the distribution, and loading a
class from there opens every JAR before it.
+ // Not the generate plugin, which camel generate installs on first use, as
it is a fifth of the download.
@SuppressWarnings("java:S1612")
private static final List<EmbeddedPlugin> PLUGINS = List.of(
- new EmbeddedPlugin(() -> new GeneratePlugin(), Set.of("generate")),
new EmbeddedPlugin(() -> new KubernetesPlugin(),
Set.of("kubernetes", "k8s")),
// its jar was in the launcher, but camel mcp installed the plugin
on first use, in the plugin configuration
new EmbeddedPlugin(() -> new McpPlugin(), Set.of("mcp")),
diff --git
a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
index b071f45afc4e..85aeec6c3965 100644
---
a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
+++
b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
@@ -25,13 +25,16 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.dsl.jbang.core.common.CommandTree;
+import org.apache.camel.dsl.jbang.core.common.PluginHelper;
import org.apache.camel.dsl.jbang.run.common.Printer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
@@ -98,7 +101,6 @@ public class CamelLauncherTest {
@Test
public void aCommandOfAnEmbeddedPluginCreatesOnlyThatPlugin() {
// creating all the commands of the CLI and the plugins costs more
than half a second
- assertEquals(Set.of("generate"), commandsOf("generate"));
assertEquals(Set.of("kubernetes", "k8s"), commandsOf("k8s", "--help"));
// embedded like the others, so camel mcp does not install it in the
plugin configuration on first use
assertEquals(Set.of("mcp"), commandsOf("mcp", "--help"));
@@ -108,7 +110,17 @@ public class CamelLauncherTest {
@Test
public void theHelpCreatesTheCommandsOfAllEmbeddedPlugins() {
assertTrue(commandsOf("--help")
- .containsAll(Set.of("version", "generate", "kubernetes",
"mcp", "self-update", "tui", "validate", "test")));
+ .containsAll(Set.of("version", "kubernetes", "mcp",
"self-update", "tui", "validate", "test")));
+ }
+
+ @Test
+ public void theGeneratePluginIsNotEmbedded() {
+ // camel generate installs it on first use: it and the OpenAPI
generator are a fifth of the download (CAMEL-27005)
+ assertFalse(commandsOf("--help").contains("generate"));
+ assertTrue(PluginHelper.isPluginCommand("generate"), "camel generate
installs the plugin on first use");
+ assertThrows(ClassNotFoundException.class,
+ () ->
Class.forName("org.apache.camel.dsl.jbang.core.commands.generate.GeneratePlugin"));
+ assertThrows(ClassNotFoundException.class, () ->
Class.forName("org.openapitools.codegen.DefaultGenerator"));
}
private static Set<String> commandsOf(String... args) {