This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch jt in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0f71c45da6f0cff20bc8108070d3ae2473b5015c Author: Claus Ibsen <[email protected]> AuthorDate: Thu Aug 14 10:20:39 2025 +0200 CAMEL-22205: camel-jbang: Document all camel.jbang options for tooling --- .../modules/ROOT/pages/camel-jbang.adoc | 105 +-------------------- dsl/camel-jbang/camel-jbang-core/pom.xml | 2 +- ...nDocMojo.java => PrepareCamelJBangDocMojo.java} | 49 +++++----- ...reJBangMojo.java => PrepareCamelJBangMojo.java} | 4 +- .../maven/packaging/PrepareCamelMainDocMojo.java | 2 +- .../src/main/resources/jbang-options.mvel | 24 +++++ 6 files changed, 55 insertions(+), 131 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc index 01dd923a5ad..31fd0ab88a4 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc @@ -3942,110 +3942,11 @@ TIP: Camel will by default store export logs to `<user home>/.camel/camel-export The export command will by default load configuration from `application.properties` which also can be used to specific parameters for export such as selecting the runtime and java version. -The follow options related to _exporting_, can be configured in `application.properties`: +The follow options related to _exporting_ or _running_, can be configured in `application.properties`: -|=== -|Option | Description +// jbang options: START +// jbang options: END -|`camel.jbang.runtime` -|Runtime (spring-boot, quarkus, or camel-main) - -|`camel.jbang.gav` -|The Maven group:artifact:version - -|`camel.jbang.dependencies` -|Additional dependencies (Use commas to separate multiple dependencies). See more details at xref:_adding_custom_jars[]. - -|`camel.jbang.excludes` -|Exclude files by name or pattern. Multiple names can be separated by comma. - -|`camel.jbang.classpathFiles` -|Additional files to add to classpath (Use commas to separate multiple files). See more details at xref:_adding_custom_jars[]. - -|`camel.jbang.jkubeFiles` -|Resource fragments for Kubernetes (Use commas to separate multiple files). - -|`camel.jbang.javaVersion` -|Java version (17 or 21). Java 17 is default. - -|`camel.jbang.kameletsVersion` -|Apache Camel Kamelets version - -|`camel.jbang.localKameletDir` -|Local file directory for loading custom Kamelets - -|`camel.jbang.camelSpringBootVersion` -|Camel version to use with Spring Boot - -|`camel.jbang.springBootVersion` -|Spring Boot version - -|`camel.jbang.quarkusGroupId` -|Quarkus Platform Maven groupId - -|`camel.jbang.quarkusArtifactId` -|Quarkus Platform Maven artifactId - -|`camel.jbang.quarkusVersion` -|Quarkus Platform version - -|`camel.jbang.mavenWrapper` -|Include Maven Wrapper files in the exported project - -|`camel.jbang.gradleWrapper` -|Include Gradle Wrapper files in the exported project - -|`camel.jbang.buildTool` -|Build tool to use (Maven or Gradle) - -|`camel.jbang.repos` -|Additional maven repositories for download on-demand (Use commas to separate multiple repositories) - -|`camel.jbang.mavenSettings` -|Optional location of Maven settings.xml file to configure servers, repositories, mirrors, and proxies. If set to false, not even the default ~/.m2/settings.xml will be used. - -|`camel.jbang.mavenSettingsSecurity` -|Optional location of Maven settings-security.xml file to decrypt settings.xml - -|`camel.jbang.mavenCentralEnabled` -|Whether downloading JARs from Maven Central repository is enabled - -|`camel.jbang.mavenApacheSnapshotEnabled` -|Whether downloading JARs from ASF Maven Snapshot repository is enabled - -|`camel.jbang.download` -|Whether to allow automatic downloading JAR dependencies (over the internet) - -|`camel.jbang.packageScanJars` -|Whether to automatic package scan JARs for custom Spring or Quarkus beans making them available for Camel JBang - -|`camel.jbang.exportDir` -|Directory where the project will be exported - -|`camel.jbang.platform-http.port` -| HTTP server port to use when running standalone Camel, such as when `--console` is enabled (port 8080 by default). - -|`camel.jbang.console` -| Developer console at /q/dev on local HTTP server (port 8080 by default) when running standalone Camel - -|`camel.jbang.health` -| Health check at /observe/health on local HTTP server (port 8080 by default) when running standalone Camel - -|`camel.jbang.metrics` -| Metrics (Micrometer and Prometheus) at /observe/metrics on local HTTP server (port 8080 by default) when running standalone Camel - -|`camel.jbang.open-api` -| File name of open-api spec file (JSON or YAML) that are used when using `--open-api` to generate routes from the swagger/openapi API spec file. - -|`camel.jbang.ignoreLoadingError` -| Whether to ignore route loading and compilation errors (use this with care!) - -|`camel.jbang.jib-maven-plugin-version` -| Version to use for jib-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options). - -|=== - -NOTE: These are options from the export command, so you can see more details and default values using `camel export --help`. == Configuration diff --git a/dsl/camel-jbang/camel-jbang-core/pom.xml b/dsl/camel-jbang/camel-jbang-core/pom.xml index 5b1a88f641f..f1b9286616c 100644 --- a/dsl/camel-jbang/camel-jbang-core/pom.xml +++ b/dsl/camel-jbang/camel-jbang-core/pom.xml @@ -179,7 +179,6 @@ <build> <plugins> - <!-- generate and include all components in the catalog --> <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-package-maven-plugin</artifactId> @@ -187,6 +186,7 @@ <execution> <goals> <goal>prepare-jbang</goal> + <goal>prepare-jbang-doc</goal> </goals> <phase>generate-resources</phase> </execution> diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainDocMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangDocMojo.java similarity index 84% copy from tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainDocMojo.java copy to tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangDocMojo.java index e0557270bc8..8d0f8450699 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainDocMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangDocMojo.java @@ -16,15 +16,6 @@ */ package org.apache.camel.maven.packaging; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.inject.Inject; - import org.apache.camel.tooling.model.JsonMapper; import org.apache.camel.tooling.model.MainModel; import org.apache.camel.tooling.util.PackageHelper; @@ -40,56 +31,64 @@ import org.apache.maven.project.MavenProjectHelper; import org.codehaus.plexus.build.BuildContext; import org.mvel2.templates.TemplateRuntime; +import javax.inject.Inject; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + /** - * Prepares camel-main by updating the main documentation. + * Prepares camel-jbang by updating the jbang documentation. */ -@Mojo(name = "prepare-main", defaultPhase = LifecyclePhase.PROCESS_CLASSES, threadSafe = true, +@Mojo(name = "prepare-jbang-doc", defaultPhase = LifecyclePhase.PROCESS_CLASSES, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) -public class PrepareCamelMainDocMojo extends AbstractGeneratorMojo { +public class PrepareCamelJBangDocMojo extends AbstractGeneratorMojo { /** * The documentation directory */ - @Parameter(defaultValue = "${project.basedir}/src/main/docs") + @Parameter(defaultValue = "${project.basedir}/../../docs/user-manual/modules/ROOT/pages") protected File docDocDir; /** - * The documentation directory + * The metadata file */ - @Parameter(defaultValue = "${project.basedir}/src/generated/resources/META-INF/camel-main-configuration-metadata.json") - protected File mainJsonFile; + @Parameter(defaultValue = "${project.basedir}/src/generated/resources/META-INF/camel-jbang-configuration-metadata.json") + protected File jbangJsonFile; @Inject - public PrepareCamelMainDocMojo(MavenProjectHelper projectHelper, BuildContext buildContext) { + public PrepareCamelJBangDocMojo(MavenProjectHelper projectHelper, BuildContext buildContext) { super(projectHelper, buildContext); } @Override public void execute(MavenProject project) throws MojoFailureException, MojoExecutionException { - docDocDir = new File(project.getBasedir(), "src/main/docs"); - mainJsonFile + docDocDir = new File(project.getBasedir().getParentFile().getParent(), "docs/user-manual/modules/ROOT/pages"); + jbangJsonFile = new File(project.getBasedir(), "src/generated/resources/META-INF/camel-main-configuration-metadata.json"); super.execute(project); } @Override public void execute() throws MojoExecutionException, MojoFailureException { - if (!mainJsonFile.exists()) { + if (!jbangJsonFile.exists()) { // it's not this module so skip return; } - File file = new File(docDocDir, "main.adoc"); + File file = new File(docDocDir, "camel-jbang.adoc"); boolean exists = file.exists(); boolean updated; try { - String json = PackageHelper.loadText(mainJsonFile); + String json = PackageHelper.loadText(jbangJsonFile); MainModel model = JsonMapper.generateMainModel(json); - String options = evaluateTemplate("main-options.mvel", model); - updated = updateOptionsIn(file, "main", options); + String options = evaluateTemplate("jbang-options.mvel", model); + updated = updateOptionsIn(file, "jbang", options); } catch (IOException e) { - throw new MojoExecutionException("Error preparing main docs", e); + throw new MojoExecutionException("Error preparing jbang docs", e); } if (updated) { diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareJBangMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangMojo.java similarity index 97% rename from tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareJBangMojo.java rename to tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangMojo.java index 10988d50b91..91dde407a9d 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareJBangMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangMojo.java @@ -48,13 +48,13 @@ import org.jboss.forge.roaster.model.source.JavaClassSource; */ @Mojo(name = "prepare-jbang", defaultPhase = LifecyclePhase.PROCESS_CLASSES, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) -public class PrepareJBangMojo extends AbstractGeneratorMojo { +public class PrepareCamelJBangMojo extends AbstractGeneratorMojo { @Parameter(defaultValue = "${project.basedir}/src/generated/resources") protected File outFolder; @Inject - public PrepareJBangMojo(MavenProjectHelper projectHelper, BuildContext buildContext) { + public PrepareCamelJBangMojo(MavenProjectHelper projectHelper, BuildContext buildContext) { super(projectHelper, buildContext); } diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainDocMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainDocMojo.java index e0557270bc8..15f5740b43b 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainDocMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainDocMojo.java @@ -54,7 +54,7 @@ public class PrepareCamelMainDocMojo extends AbstractGeneratorMojo { protected File docDocDir; /** - * The documentation directory + * The metadata file */ @Parameter(defaultValue = "${project.basedir}/src/generated/resources/META-INF/camel-main-configuration-metadata.json") protected File mainJsonFile; diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/jbang-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/jbang-options.mvel new file mode 100644 index 00000000000..c7491e55c48 --- /dev/null +++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/jbang-options.mvel @@ -0,0 +1,24 @@ +@comment{ + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +} +=== @{group.description} +The @{group.name} supports @{options.size()} options, which are listed below. + +[width="100%",cols="2,5,^1,2",options="header"] +|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } +| Name | Description | Default | Type +@foreach{row : options}| *@{row.getShortName(30)}* @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType()} +@end{}|===
