You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/02/14 09:43:51 UTC

[camel-spring-boot] 01/04: CAMEL-14539: Fixed spring-boot -starter adoc generation to include START END markers

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit 1ae004a23a9988da996e32ae50ec5618212d287d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 14 10:29:43 2020 +0100

    CAMEL-14539: Fixed spring-boot -starter adoc generation to include START END markers
---
 .../camel-ahc-starter/src/main/docs/ahc-starter.adoc      |  2 ++
 .../UpdateSpringBootAutoConfigurationReadmeMojo.java      | 15 +++++----------
 .../resources/spring-boot-auto-configure-options.mvel     |  2 ++
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/components-starter/camel-ahc-starter/src/main/docs/ahc-starter.adoc b/components-starter/camel-ahc-starter/src/main/docs/ahc-starter.adoc
index f54e950..bfaed62 100644
--- a/components-starter/camel-ahc-starter/src/main/docs/ahc-starter.adoc
+++ b/components-starter/camel-ahc-starter/src/main/docs/ahc-starter.adoc
@@ -1,3 +1,4 @@
+// spring-boot-auto-configure options: START
 :page-partial:
 :doctitle: Camel Spring Boot Starter for ahc
 
@@ -35,3 +36,4 @@ The component supports 10 options, which are listed below.
 | *camel.component.ahc.use-global-ssl-context-parameters* | Enable usage of global SSL context parameters. | false | Boolean
 |===
 
+// spring-boot-auto-configure options: END
diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/UpdateSpringBootAutoConfigurationReadmeMojo.java b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/UpdateSpringBootAutoConfigurationReadmeMojo.java
index a3c95f6..6c60078 100644
--- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/UpdateSpringBootAutoConfigurationReadmeMojo.java
+++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/UpdateSpringBootAutoConfigurationReadmeMojo.java
@@ -88,7 +88,7 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         try {
-            executeStarter(project.getBasedir());
+            executeStarter(buildDir.getParentFile());
         } catch (Exception e) {
             throw new MojoFailureException("Error processing spring-configuration-metadata.json", e);
         }
@@ -111,7 +111,7 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
                 // skip camel-  and -starter in the end
                 String componentName = name.substring(6, name.length() - 8);
                 getLog().debug("Camel component: " + componentName);
-                File docFolder = new File("components-starter/" + name + "/src/main/docs/");
+                File docFolder = new File(starter,"src/main/docs/");
                 File docFile = new File(docFolder, componentName + "-starter.adoc");
 
                 List<SpringBootAutoConfigureOptionModel> models = parseSpringBootAutoConfigureModels(jsonFile, null);
@@ -244,14 +244,9 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
                     return true;
                 }
             } else {
-                getLog().warn("Cannot find markers in file " + file);
-                getLog().warn("Add the following markers");
-                getLog().warn("\t// spring-boot-auto-configure options: START");
-                getLog().warn("\t// spring-boot-auto-configure options: END");
-                if (isFailFast()) {
-                    throw new MojoExecutionException("Failed build due failFast=true");
-                }
-                return false;
+                // override existing file with new content
+                writeText(file, changed);
+                return true;
             }
         } catch (Exception e) {
             throw new MojoExecutionException("Error reading file " + file + " Reason: " + e, e);
diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-auto-configure-options.mvel b/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-auto-configure-options.mvel
index 955a761..366e46c 100644
--- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-auto-configure-options.mvel
+++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-auto-configure-options.mvel
@@ -1,3 +1,4 @@
+// spring-boot-auto-configure options: START
 :page-partial:
 :doctitle: Camel Spring Boot Starter for @{title}
 
@@ -28,3 +29,4 @@ The component supports @{options.size()} options, which are listed below.
 @foreach{row : options}| *@{row.name}* | @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType()}
 @end{}|===
 @end{}
+// spring-boot-auto-configure options: END
\ No newline at end of file