This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-12644 in repository https://gitbox.apache.org/repos/asf/camel.git
commit eae02da5882c10b04d4c92eea787418ccd4a491a Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Jul 17 10:01:10 2018 +0200 CAMEL-12644: Generate spring boot auto configuration in the docs. --- components/camel-spring-boot/pom.xml | 29 ++ .../src/main/docs/spring-boot.adoc | 291 +++++++++++++++++++++ ...pdateSpringBootAutoConfigurationReadmeMojo.java | 42 ++- 3 files changed, 353 insertions(+), 9 deletions(-) diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml index 345ae1a..69149a5 100644 --- a/components/camel-spring-boot/pom.xml +++ b/components/camel-spring-boot/pom.xml @@ -54,6 +54,12 @@ </dependency> <dependency> <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-autoconfigure-processor</artifactId> + <optional>true</optional> + <version>${spring-boot-version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> <optional>true</optional> <version>${spring-boot-version}</version> @@ -126,6 +132,29 @@ </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-package-maven-plugin</artifactId> + <version>${project.version}</version> + <configuration> + <!-- set to true to make build fail fast if missing documentation in docs files --> + <failFast>true</failFast> + </configuration> + <executions> + <execution> + <id>readme</id> + <goals> + <goal>update-spring-boot-auto-configuration-readme</goal> + </goals> + <phase>package</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + <profiles> <profile> <id>jdk9+-build</id> diff --git a/components/camel-spring-boot/src/main/docs/spring-boot.adoc b/components/camel-spring-boot/src/main/docs/spring-boot.adoc index f4a746d..9cc31d5 100644 --- a/components/camel-spring-boot/src/main/docs/spring-boot.adoc +++ b/components/camel-spring-boot/src/main/docs/spring-boot.adoc @@ -74,6 +74,297 @@ Then these routes will be started automatically. You can customize the Camel application in the `application.properties` or `application.yml` file. + +// spring-boot-auto-configure options: START +=== Spring Boot Auto-Configuration + + +The component supports 139 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *camel.cloud.enabled* | | true | Boolean +| *camel.cloud.load-balancer.enabled* | | true | Boolean +| *camel.cloud.service-call.component* | The component to use. | | String +| *camel.cloud.service-call.default-load-balancer* | Determine if the default load balancer should be used instead of any auto discovered one. | false | Boolean +| *camel.cloud.service-call.expression* | The {@link Expression} to use. | | String +| *camel.cloud.service-call.expression-language* | The {@link Expression} language to use, default is ref | ref | String +| *camel.cloud.service-call.load-balancer* | A reference to the {@link ServiceLoadBalancer} to use. | | String +| *camel.cloud.service-call.service-chooser* | A reference to the {@link org.apache.camel.cloud.ServiceChooser} to use. | | String +| *camel.cloud.service-call.service-discovery* | A reference to the {@link org.apache.camel.cloud.ServiceDiscovery} to use. | | String +| *camel.cloud.service-call.service-filter* | A reference to the {@link org.apache.camel.cloud.ServiceFilter} to use. | | String +| *camel.cloud.service-call.uri* | The uri of the endpoint to send to. + The uri can be dynamic computed using the {@link org.apache.camel.language.simple.SimpleLanguage} expression. | | String +| *camel.cloud.service-chooser.enabled* | | true | Boolean +| *camel.cloud.service-discovery.cache-timeout* | | | String +| *camel.cloud.service-discovery.configurations* | | | Map +| *camel.cloud.service-discovery.enabled* | | true | Boolean +| *camel.cloud.service-discovery.services* | | | Map +| *camel.cloud.service-filter.blacklist* | | | Map +| *camel.cloud.service-filter.configurations* | | | Map +| *camel.cloud.service-filter.enabled* | | true | Boolean +| *camel.cloud.service-registry.enabled* | Configure if service registry should be enabled or not, default true. | true | Boolean +| *camel.cloud.service-registry.service-host* | Configure the service listening address. | | String +| *camel.clustered.controller.cluster-service* | The cluster service. | | CamelClusterService +| *camel.clustered.controller.enabled* | Global option to enable/disable this ${@link org.apache.camel.spi.RouteController}, default is false. | false | Boolean +| *camel.clustered.controller.initial-delay* | Set the amount of time the route controller should wait before to start + the routes after the camel context is started or after the route is + initialized if the route is created after the camel context is started. | | String +| *camel.clustered.controller.namespace* | The default namespace. | | String +| *camel.clustered.controller.routes* | Routes configuration. | | Map +| *camel.component.enabled* | Global option to enable/disable component auto-configuration, default is true. | true | Boolean +| *camel.dataformat.enabled* | Global option to enable/disable dataformat auto-configuration, default is true. | true | Boolean +| *camel.health.check.routes.enabled* | Global option to enable/disable this ${@link org.apache.camel.health.HealthCheckRepository}, default is false. | false | Boolean +| *camel.health.check.routes.threshold* | configurations | | Map +| *camel.health.check.routes.thresholds.exchanges-failed* | Number of failed exchanges. | | Long +| *camel.health.check.routes.thresholds.exchanges-inflight* | Number of inflight exchanges. | | Long +| *camel.health.check.routes.thresholds.external-redeliveries* | Number of external initiated redeliveries (such as from JMS broker). | | Long +| *camel.health.check.routes.thresholds.last-processing-time.failures* | Failures | | Integer +| *camel.health.check.routes.thresholds.last-processing-time.threshold* | The Threshold | | String +| *camel.health.check.routes.thresholds.max-processing-time.failures* | Failures | | Integer +| *camel.health.check.routes.thresholds.max-processing-time.threshold* | The Threshold | | String +| *camel.health.check.routes.thresholds.mean-processing-time.failures* | Failures | | Integer +| *camel.health.check.routes.thresholds.mean-processing-time.threshold* | The Threshold | | String +| *camel.health.check.routes.thresholds.min-processing-time.failures* | Failures | | Integer +| *camel.health.check.routes.thresholds.min-processing-time.threshold* | The Threshold | | String +| *camel.health.check.routes.thresholds.redeliveries* | Number of redeliveries (internal only). | | Long +| *camel.health.check.service.check-interval* | The interval between checks. | | String +| *camel.health.check.service.checks* | Checks configuration.s | | Map +| *camel.health.check.service.enabled* | Global option to enable/disable this ${@link org.apache.camel.health.HealthCheckService}, default is false. | false | Boolean +| *camel.health.enabled* | Global option to enable/disable camel health bean, default is true. | true | Boolean +| *camel.language.enabled* | Global option to enable/disable language auto-configuration, default is true. | true | Boolean +| *camel.springboot.allow-use-original-message* | Sets whether to allow access to the original message from Camel's error handler, + or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). + Turning this off can optimize performance, as defensive copy of the original message is not needed. + + Default is false. | false | Boolean +| *camel.springboot.auto-startup* | Sets whether the object should automatically start when Camel starts. + Important: Currently only routes can be disabled, as CamelContext's are always started. + Note: When setting auto startup false on CamelContext then that takes precedence + and no routes is started. You would need to start CamelContext explicit using + the org.apache.camel.CamelContext.start() method, to start the context, and then + you would need to start the routes manually using CamelContext.startRoute(String). + + Default is true to always start up. | true | Boolean +| *camel.springboot.consumer-template-cache-size* | Consumer template endpoints cache size. | 1000 | Integer +| *camel.springboot.duration-max-idle-seconds* | To specify for how long time in seconds Camel can be idle before automatic terminating the JVM. + You can use this to run Spring Boot for a short while. | 0 | Integer +| *camel.springboot.duration-max-messages* | To specify how many messages to process by Camel before automatic terminating the JVM. + You can use this to run Spring Boot for a short while. | 0 | Integer +| *camel.springboot.duration-max-seconds* | To specify for how long time in seconds to keep running the JVM before automatic terminating the JVM. + You can use this to run Spring Boot for a short while. | 0 | Integer +| *camel.springboot.endpoint-runtime-statistics-enabled* | Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints). + + The default value is false. | false | Boolean +| *camel.springboot.file-configurations* | Directory to load additional configuration files that contains + configuration values that takes precedence over any other configuration. + This can be used to refer to files that may have secret configuration that + has been mounted on the file system for containers. + <p/> + You must use either <tt>file:</tt> or <tt>classpath:</tt> as prefix to load + from file system or classpath. Then you can specify a pattern to load + from sub directories and a name pattern such as <tt>file:/var/app/secret/*.properties</tt> | | String +| *camel.springboot.handle-fault* | Sets whether fault handling is enabled or not. + + Default is false. | false | Boolean +| *camel.springboot.include-non-singletons* | Whether to include non-singleton beans (prototypes) when scanning for RouteBuilder instances. + By default only singleton beans is included in the context scan. | false | Boolean +| *camel.springboot.java-routes-exclude-pattern* | Used for exclusive filtering component scanning of RouteBuilder classes with @Component annotation. + The exclusive filtering takes precedence over inclusive filtering. + The pattern is using Ant-path style pattern. + Multiple patterns can be specified separated by comma. + <p/> + For example to exclude all classes starting with Bar use <tt>**/Bar*</tt>. + To exclude all routes form a specific package use, <tt>com/mycompany/bar/*</tt> + To exclude all routes form a specific package and its sub-packages use double wildcards, <tt>com/mycompany/bar/**</tt> + And to exclude all routes from two specific packages use, <tt>com/mycompany/bar/*,com/mycompany/stuff/*</tt> + + @see org.springframework.util.AntPathMatcher | | String +| *camel.springboot.java-routes-include-pattern* | Used for inclusive filtering component scanning of RouteBuilder classes with @Component annotation. + The exclusive filtering takes precedence over inclusive filtering. + The pattern is using Ant-path style pattern. + <p/> + Multiple patterns can be specified separated by comma. + For example to include all classes starting with Foo use <tt>**/Foo*</tt>. + To include all routes form a specific package use, <tt>com/mycompany/foo/*</tt> + To include all routes form a specific package and its sub-packages use double wildcards, <tt>com/mycompany/foo/**</tt> + And to include all routes from two specific packages use, <tt>com/mycompany/foo/*,com/mycompany/stuff/*</tt> + + @see org.springframework.util.AntPathMatcher | | String +| *camel.springboot.jmx-create-connector* | Whether JMX connector is created, allowing clients to connect remotely + + The default value is false. | false | Boolean +| *camel.springboot.jmx-enabled* | Enable JMX in your Camel application. | true | Boolean +| *camel.springboot.jmx-management-name-pattern* | The naming pattern for creating the CamelContext JMX management name. + + The default pattern is #name# | #name# | String +| *camel.springboot.jmx-management-statistics-level* | Sets the JMX statistics level + The level can be set to Extended to gather additional information + + The default value is Default. | | ManagementStatistics Level +| *camel.springboot.load-type-converters* | Sets whether to load custom type converters by scanning classpath. + This can be turned off if you are only using Camel components + that does not provide type converters which is needed at runtime. + In such situations setting this option to false, can speedup starting + Camel. | true | Boolean +| *camel.springboot.log-debug-max-chars* | Is used to limit the maximum length of the logging Camel message bodies. If the message body + is longer than the limit, the log message is clipped. Use -1 to have unlimited length. + Use for example 1000 to log at most 1000 characters. | 0 | Integer +| *camel.springboot.log-exhausted-message-body* | Sets whether to log exhausted message body with message history. + + Default is false. | false | Boolean +| *camel.springboot.log-mask* | Sets whether log mask is enabled or not. + + Default is false. | false | Boolean +| *camel.springboot.main-run-controller* | Whether to use the main run controller to ensure the Spring-Boot application + keeps running until being stopped or the JVM terminated. + You typically only need this if you run Spring-Boot standalone. + If you run Spring-Boot with spring-boot-starter-web then the web container keeps the JVM running. | false | Boolean +| *camel.springboot.message-history* | Sets whether message history is enabled or not. + + Default is true. | true | Boolean +| *camel.springboot.name* | Sets the name of the CamelContext. | | String +| *camel.springboot.producer-template-cache-size* | Producer template endpoints cache size. | 1000 | Integer +| *camel.springboot.shutdown-log-inflight-exchanges-on-timeout* | Sets whether to log information about the inflight Exchanges which are still running + during a shutdown which didn't complete without the given timeout. | true | Boolean +| *camel.springboot.shutdown-now-on-timeout* | Sets whether to force shutdown of all consumers when a timeout occurred and thus + not all consumers was shutdown within that period. + <p/> + You should have good reasons to set this option to <tt>false</tt> as it means that the routes + keep running and is halted abruptly when CamelContext has been shutdown. | true | Boolean +| *camel.springboot.shutdown-routes-in-reverse-order* | Sets whether routes should be shutdown in reverse or the same order as they where started. | true | Boolean +| *camel.springboot.shutdown-suppress-logging-on-timeout* | Whether Camel should try to suppress logging during shutdown and timeout was triggered, + meaning forced shutdown is happening. And during forced shutdown we want to avoid logging + errors/warnings et all in the logs as a side-effect of the forced timeout. + <p/> + By default this is <tt>false</tt> + <p/> + Notice the suppress is a <i>best effort</i> as there may still be some logs coming + from 3rd party libraries and whatnot, which Camel cannot control. | false | Boolean +| *camel.springboot.shutdown-timeout* | Timeout in seconds to graceful shutdown Camel. | 300 | Integer +| *camel.springboot.stream-caching* | Sets whether stream caching is enabled or not. + + Default is false. + + @deprecated use {@link #streamCachingEnabled} | false | Boolean +| *camel.springboot.stream-caching-any-spool-rules* | Sets whether if just any of the {@link org.apache.camel.spi.StreamCachingStrategy.SpoolRule} rules + returns <tt>true</tt> then shouldSpoolCache(long) returns <tt>true</tt>. + If this option is <tt>false</tt>, then <b>all</b> the {@link org.apache.camel.spi.StreamCachingStrategy.SpoolRule} must + return <tt>true</tt>. + <p/> + The default value is <tt>false</tt> which means that all the rules must return <tt>true</tt>. | false | Boolean +| *camel.springboot.stream-caching-buffer-size* | Sets the stream caching buffer size to use when allocating in-memory buffers used for in-memory stream caches. + <p/> + The default size is {@link org.apache.camel.util.IOHelper#DEFAULT_BUFFER_SIZE} | 0 | Integer +| *camel.springboot.stream-caching-enabled* | Sets whether stream caching is enabled or not. + + Default is false. | false | Boolean +| *camel.springboot.stream-caching-remove-spool-directory-when-stopping* | Whether to remove stream caching temporary directory when stopping. + <p/> + This option is default <tt>true</tt> | true | Boolean +| *camel.springboot.stream-caching-spool-chiper* | Sets a stream caching chiper name to use when spooling to disk to write with encryption. + <p/> + By default the data is not encrypted. | | String +| *camel.springboot.stream-caching-spool-directory* | Sets the stream caching spool (temporary) directory to use for overflow and spooling to disk. + <p/> + If no spool directory has been explicit configured, then a temporary directory + is created in the <tt>java.io.tmpdir</tt> directory. | | String +| *camel.springboot.stream-caching-spool-threshold* | Stream caching threshold in bytes when overflow to disk is activated. + <p/> + The default threshold is {@link org.apache.camel.StreamCache#DEFAULT_SPOOL_THRESHOLD} bytes (eg 128kb). + Use <tt>-1</tt> to disable overflow to disk. | 0 | Long +| *camel.springboot.stream-caching-spool-used-heap-memory-limit* | Sets what the upper bounds should be when streamCachingSpoolUsedHeapMemoryThreshold is in use. | | String +| *camel.springboot.stream-caching-spool-used-heap-memory-threshold* | Sets a percentage (1-99) of used heap memory threshold to activate stream caching spooling to disk. | 0 | Integer +| *camel.springboot.stream-caching-statistics-enabled* | Sets whether stream caching statistics is enabled. | false | Boolean +| *camel.springboot.thread-name-pattern* | Sets the thread name pattern used for creating the full thread name. + <p/> + The default pattern is: <tt>Camel (#camelId#) thread ##counter# - #name#</tt> + <p/> + Where <tt>#camelId#</tt> is the name of the {@link org.apache.camel.CamelContext} + <br/>and <tt>#counter#</tt> is a unique incrementing counter. + <br/>and <tt>#name#</tt> is the regular thread name. + <br/>You can also use <tt>#longName#</tt> is the long thread name which can includes endpoint parameters etc. | | String +| *camel.springboot.trace-formatter-show-body* | Tracer should output message body | true | Boolean +| *camel.springboot.trace-formatter-show-bread-crumb* | Tracer should output breadcrumb | true | Boolean +| *camel.springboot.trace-formatter-show-exception* | Tracer should output exception | true | Boolean +| *camel.springboot.trace-formatter-show-exchange-id* | Tracer should output exchange id | false | Boolean +| *camel.springboot.trace-formatter-show-exchange-pattern* | Tracer should output message exchange pattern (MEP) | true | Boolean +| *camel.springboot.trace-formatter-show-headers* | Tracer should output message headers | true | Boolean +| *camel.springboot.trace-formatter-show-node* | Tracer should output EIP node | true | Boolean +| *camel.springboot.trace-formatter-show-properties* | Tracer should output exchange properties | false | Boolean +| *camel.springboot.trace-formatter-show-route-id* | Tracer should output route id | true | Boolean +| *camel.springboot.trace-formatter-show-short-exchange-id* | Tracer should output short exchange id | false | Boolean +| *camel.springboot.tracer-formatter-bread-crumb-length* | Tracer maximum length of breadcrumb ids | | Integer +| *camel.springboot.tracer-formatter-max-chars* | Tracer maximum characters in total | 10000 | Integer +| *camel.springboot.tracer-formatter-node-length* | Tracer maximum length of node | | Integer +| *camel.springboot.tracer-formatter-show-body-type* | Tracer should output message body type | true | Boolean +| *camel.springboot.tracing* | Sets whether tracing is enabled or not. + + Default is false. | false | Boolean +| *camel.springboot.type-conversion* | Enables enhanced Camel/Spring type conversion. | true | Boolean +| *camel.springboot.use-breadcrumb* | Set whether breadcrumb is enabled. | true | Boolean +| *camel.springboot.use-data-type* | Whether to enable using data type on Camel messages. + <p/> + Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. + Otherwise data type is default off. | false | Boolean +| *camel.springboot.use-m-d-c-logging* | To turn on MDC logging + + @deprecated use useMdcLogging instead | false | Boolean +| *camel.springboot.use-mdc-logging* | To turn on MDC logging | false | Boolean +| *camel.springboot.xml-rests* | Directory to scan for adding additional XML rests. + You can turn this off by setting the value to false. | classpath:camel-rest/*.xml | String +| *camel.springboot.xml-routes* | Directory to scan for adding additional XML routes. + You can turn this off by setting the value to false. | classpath:camel/*.xml | String +| *camel.springboot.xml-routes-reload-directory* | To watch the directory for file changes which triggers + a live reload of the Camel routes on-the-fly. + <p/> + For example configure this to point to the source code where the Camel XML files are located + such as: src/main/resources/camel/ | | String +| *camel.ssl.config.camel-context* | | | CamelContext +| *camel.ssl.config.cert-alias* | | | String +| *camel.ssl.config.cipher-suites* | | | CipherSuitesParameters +| *camel.ssl.config.cipher-suites-filter* | | | FilterParameters +| *camel.ssl.config.client-parameters* | | | SSLContextClient Parameters +| *camel.ssl.config.key-managers* | | | KeyManagersParameters +| *camel.ssl.config.provider* | | | String +| *camel.ssl.config.secure-random* | | | SecureRandomParameters +| *camel.ssl.config.secure-socket-protocol* | | | String +| *camel.ssl.config.secure-socket-protocols* | | | SecureSocketProtocols Parameters +| *camel.ssl.config.secure-socket-protocols-filter* | | | FilterParameters +| *camel.ssl.config.server-parameters* | | | SSLContextServer Parameters +| *camel.ssl.config.session-timeout* | | | String +| *camel.ssl.config.trust-managers* | | | TrustManagersParameters +| *camel.supervising.controller.default-back-off.delay* | The delay to wait before retry the operation. + + You can also specify time values using units, such as 60s (60 seconds), + 5m30s (5 minutes and 30 seconds), and 1h (1 hour). | | String +| *camel.supervising.controller.default-back-off.max-attempts* | The maximum number of attempts after which the back-off is exhausted. | | Long +| *camel.supervising.controller.default-back-off.max-delay* | The maximum back-off time. + + You can also specify time values using units, such as 60s (60 seconds), + 5m30s (5 minutes and 30 seconds), and 1h (1 hour). | | String +| *camel.supervising.controller.default-back-off.max-elapsed-time* | The maximum elapsed time after which the back-off is exhausted. + + You can also specify time values using units, such as 60s (60 seconds), + 5m30s (5 minutes and 30 seconds), and 1h (1 hour). | | String +| *camel.supervising.controller.default-back-off.multiplier* | The value to multiply the current interval by for each retry attempt. | | Double +| *camel.supervising.controller.enabled* | Global option to enable/disable this ${@link org.apache.camel.spi.RouteController}, default is false. | false | Boolean +| *camel.supervising.controller.initial-delay* | Set the amount of time the route controller should wait before to start + the routes after the camel context is started or after the route is + initialized if the route is created after the camel context is started. | | String +| *camel.supervising.controller.routes* | Routes configuration. | | Map +| *management.endpoint.camelroutecontroller.cache.time-to-live* | Maximum time that a response can be cached. | 0ms | Duration +| *management.endpoint.camelroutecontroller.enabled* | To turn on or off information about Camel Route Controller via actuator endpoint. | true | Boolean +| *management.endpoint.camelroutes.cache.time-to-live* | Maximum time that a response can be cached. | 0ms | Duration +| *management.endpoint.camelroutes.enabled* | To turn on or off information about Camel Routes via actuator endpoint. | true | Boolean +| *management.endpoint.camelroutes.read-only* | Whether Camel Routes actuator is in read-only mode. If not in read-only mode then operations to start/stop routes would be enabled. | true | Boolean +| *management.info.camel.enabled* | Whether to enable Camel info. | true | Boolean +|=== +// spring-boot-auto-configure options: END + [[SpringBoot-Auto-configuredCamelcontext]] === Auto-configured Camel context diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java index abbfc83..9514905 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java @@ -49,6 +49,9 @@ import static org.apache.camel.maven.packaging.PackageHelper.writeText; */ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo { + // TODO: camel-aws filter out options per component name in the doc file + // TODO: some dataformats same issue like univocity + /** * The maven project. * @@ -111,18 +114,30 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo { return; } - // skip camel- and -starter in the end - String componentName = name.substring(6, name.length() - 8); - getLog().debug("Camel component: " + componentName); - File docFolder = new File(componentsDir, "camel-" + componentName + "/src/main/docs/"); - // update all adoc files (as it may be component, language, data-format or just other kind) - File[] docFiles = docFolder.listFiles(new ComponentDocFilter(componentName)); + File compDir = getComponentsDir(name); - // maybe its one of those that has a sub-folder - if (docFiles == null || docFiles.length == 0) { - docFolder = new File(componentsDir, "camel-" + componentName + "/camel-" + componentName + "-component/src/main/docs/"); + File[] docFiles; + File docFolder; + String componentName; + if ("camel-spring-boot".equals(name)) { + // special for camel-spring-boot where we also want to auto-generate the options in the adoc file + componentName = "spring-boot"; + docFolder = new File(compDir, "/src/main/docs/"); + docFiles = docFolder.listFiles(new ComponentDocFilter(componentName)); + } else { + // skip camel- and -starter in the end + componentName = name.substring(6, name.length() - 8); + getLog().debug("Camel component: " + componentName); + docFolder = new File(compDir, "camel-" + componentName + "/src/main/docs/"); // update all adoc files (as it may be component, language, data-format or just other kind) docFiles = docFolder.listFiles(new ComponentDocFilter(componentName)); + + // maybe its one of those that has a sub-folder + if (docFiles == null || docFiles.length == 0) { + docFolder = new File(compDir, "camel-" + componentName + "/camel-" + componentName + "-component/src/main/docs/"); + // update all adoc files (as it may be component, language, data-format or just other kind) + docFiles = docFolder.listFiles(new ComponentDocFilter(componentName)); + } } if (docFiles != null && docFiles.length > 0) { @@ -162,6 +177,15 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo { } } + private File getComponentsDir(String name) { + if ("camel-spring-boot".equals(name)) { + // special for camel-spring-boot + return project.getBasedir(); + } else { + return componentsDir; + } + } + private static final class ComponentDocFilter implements FileFilter { private final String componentName;