Ricardo Martinez created CAMEL-24727:
----------------------------------------

             Summary: camel-jbang: stage 2 - extract camel-jbang-export module
                 Key: CAMEL-24727
                 URL: https://issues.apache.org/jira/browse/CAMEL-24727
             Project: Camel
          Issue Type: Sub-task
          Components: camel-jbang
            Reporter: Ricardo Martinez


h2. Motivation

The only Java API to export a Camel integration to a Maven project is 
{{camel-jbang-core}}, i.e. the Camel CLI itself. Every consumer therefore 
depends on picocli, jline and ~3500 lines of Run.

This stage moves the export machinery into a picocli-free library module so 
that consumers like Kaoto and the Camel TUI can create and run exported 
projects through a pure Java API.

h2. What changes

New module {{dsl/camel-jbang/camel-jbang-export}} (package 
{{org.apache.camel.dsl.jbang.export}}).

Dependencies: camel-kamelet-main, camel-tooling-maven, camel-catalog, 
freemarker, plexus-xml, snakeyaml. No picocli, no jline.

Key relocated / new types:

|| Today (camel-jbang-core) || Moves to camel-jbang-export ||
| ExportBaseCommand option fields | {{ExportRequest}} — plain mutable config |
| ExportBaseCommand logic (resolveDependencies, copySourceFiles, 
copyMavenWrapper, ...) | {{Exporter}} abstract class, same protected hook names 
|
| ExportCamelMain, ExportQuarkus, ExportSpringBoot (package-private) | 
{{CamelMainExporter}}, {{QuarkusExporter}}, {{SpringBootExporter}} (public) |
| Export.doExport() runtime switch | {{ProjectExporter}} facade: {{int 
export(ExportRequest)}} |
| ExportBaseCommand.runSilently(), Run exportRun branch, RunDownloadListener, 
writeSettings | {{SilentRun}} + {{RunSettings}} |
| ExportHelper, RunHelper pom half, TemplateHelper, VersionHelper, 
QuarkusHelper, RuntimeUtil, PathUtils, XmlHelper, and others | move as-is 
(already picocli-free) |
| RuntimeType, CamelJBangConstants, PluginExporter, Printer, Source, 
SourceScheme, SourceHelper | move; consumers rewrite imports |
| pom.ftl templates, Dockerfiles, readme templates, run-java.sh, 
maven-wrapper/, camel-wrapper/ | move |

{{Export}} and {{ExportBaseCommand}} stay in {{camel-jbang-core}} as picocli 
delegates until stage 6. {{camel-jbang-runner}} dependency flips from 
{{camel-jbang-core}} to {{camel-jbang-export}}.

{{Run}} loses the exportRun branch, RunDownloadListener, writeSettings and the 
bodies of the three run<Runtime> methods (~700 lines); they become calls to 
ProjectExporter and ProjectRunner.

Add the module to {{dsl/camel-jbang/pom.xml}}, {{bom/camel-bom}} and the 
camel-package-maven-plugin config. Move export-related tests (ExportTest, 
ExportHelperTest, RuntimeTypeTest) to the new module.

h2. Compatibility

* Package change for RuntimeType, Printer, PluginExporter, CamelJBangConstants, 
SourceScheme, ExportHelper — in-tree consumers rewrite imports in the same PR; 
out-of-tree camel-jbang plugins need the same import rewrite. Document in the 
4.x upgrade guide.
* {{.camel-jbang/camel-jbang-run.properties}} path and keys are preserved.
* No CLI option added, removed or renamed.

h2. Note

After this stage a consumer of {{camel-jbang-export}} or {{camel-jbang-runner}} 
no longer carries picocli or jline. camel-kamelet-main is still a mandatory 
compile dependency of
{{camel-jbang-export}} (resolved in stage 7).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to