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:53 UTC

[camel-spring-boot] 03/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 b2d0ad75ad490b8d01f5dd608de7b428983d930c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 14 10:40:09 2020 +0100

    CAMEL-14539: Fixed spring-boot -starter adoc generation to include START END markers
---
 .../maven/UpdateSpringBootAutoConfigurationReadmeMojo.java  | 13 ++++++++++---
 .../main/resources/spring-boot-auto-configure-options.mvel  |  4 +---
 2 files changed, 11 insertions(+), 6 deletions(-)

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 6c60078..3a99f54 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
@@ -223,6 +223,8 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
     private boolean updateAutoConfigureOptions(File file, String changed) throws MojoExecutionException {
         try {
             if (!file.exists()) {
+                // include markers for new files
+                changed = "// spring-boot-auto-configure options: START\n" + changed + "\n// spring-boot-auto-configure options: END\n";
                 writeText(file, changed);
                 return true;
             }
@@ -244,9 +246,14 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
                     return true;
                 }
             } else {
-                // override existing file with new content
-                writeText(file, changed);
-                return true;
+                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;
             }
         } 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 366e46c..b33863f 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,4 +1,3 @@
-// spring-boot-auto-configure options: START
 :page-partial:
 :doctitle: Camel Spring Boot Starter for @{title}
 
@@ -28,5 +27,4 @@ The component supports @{options.size()} options, which are listed below.
 | Name | Description | Default | Type
 @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
+@end{}
\ No newline at end of file