Repository: camel Updated Branches: refs/heads/boot-generate 75ca9d139 -> 4b7844732
Experiment with generating spring-boot auto configuration for the Camel components. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9c4c43e2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9c4c43e2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9c4c43e2 Branch: refs/heads/boot-generate Commit: 9c4c43e2cc98fb170480bd60bad0621e6b9c59a8 Parents: 75ca9d1 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Jun 7 16:21:07 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Jun 7 16:21:07 2016 +0200 ---------------------------------------------------------------------- .../SpringBootAutoConfigurationMojo.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/9c4c43e2/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java index 0d33997..3009a37 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java @@ -113,14 +113,18 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { if (json != null) { ComponentModel model = generateComponentModel(componentName, json); - // use springboot as sub package name so the code is not in normal - // package so the Spring Boot JARs can be optional at runtime - int pos = model.getJavaType().lastIndexOf("."); - String pkg = model.getJavaType().substring(0, pos) + ".springboot"; - - createComponentConfigurationSource(pkg, model); - createComponentAutoConfigurationSource(pkg, model); - createSpringFactorySource(pkg, model); + // only create source code if the component has options that can be used in auto configuration + if (!model.getComponentOptions().isEmpty() { + + // use springboot as sub package name so the code is not in normal + // package so the Spring Boot JARs can be optional at runtime + int pos = model.getJavaType().lastIndexOf("."); + String pkg = model.getJavaType().substring(0, pos) + ".springboot"; + + createComponentConfigurationSource(pkg, model); + createComponentAutoConfigurationSource(pkg, model); + createSpringFactorySource(pkg, model); + } } } }