Skip to content

Commit

Permalink
CAMEL-10222: Added docs and examples and added a small fix to integra…
Browse files Browse the repository at this point in the history
…tion tests
  • Loading branch information
nicolaferraro committed Sep 20, 2016
1 parent a0cacd9 commit 1e16019
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 6 deletions.
27 changes: 27 additions & 0 deletions components-starter/README.adoc
@@ -0,0 +1,27 @@
= Camel Component Starters

Starters are Apache Camel modules intended to be used in Spring Boot applications.
There is a `camel-xxx-starter` module for each Camel component (with few exceptions listed below).

Starters are created to meet the following requirements:

* Allow the auto-configuration of the component through the native spring-boot configuration system (compatible with IDE tooling)
* Manage transitive logging dependencies to better integrate with spring-boot logging system
* Include additional dependencies and align transitive ones to minimize the effort of creating a working spring-boot application
Each starter has its own integration test (in path `tests/camel-itest-spring-boot`) that verifies its compatibility with the current release of spring-boot.

The following components do not have a starter because of compatibility issues:

* **camel-blueprint**
* **camel-cdi**
* **camel-core-osgi**
* **camel-ejb**
* **camel-eventadmin**
* **camel-ibatis** (`camel-mybatis-starter` is included)
* **camel-jclouds**
* **camel-mina** (`camel-mina2-starter` is included)
* **camel-paxlogging**
* **camel-quartz** (`camel-quartz2-starter` is included)
* **camel-spark-rest**
* **camel-swagger** (`camel-swagger-java-starter` is included)
4 changes: 2 additions & 2 deletions examples/camel-example-hystrix/client/pom.xml
Expand Up @@ -69,11 +69,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<artifactId>camel-http-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-hystrix</artifactId>
<artifactId>camel-hystrix-starter</artifactId>
</dependency>

</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions examples/camel-example-hystrix/service1/pom.xml
Expand Up @@ -69,15 +69,15 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-hystrix</artifactId>
<artifactId>camel-hystrix-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jetty</artifactId>
<artifactId>camel-jetty-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<artifactId>camel-http-starter</artifactId>
</dependency>

</dependencies>
Expand Down
46 changes: 46 additions & 0 deletions spring-boot-dm/README.adoc
@@ -0,0 +1,46 @@
= Camel Spring-Boot Dependency Management

The `spring-boot-dm` module include tools to generate a valid spring-boot BOM (bill of materials)
that can be used in spring-boot applications.

Using the generated BOM (`camel-spring-boot-dependencies`), together with the Spring framework's `spring-boot-dependencies`,
is the preferred way of configuring a Camel-based application running on Spring-Boot.

The POM of a end user application should include both BOMs, as in the following example:

[source,xml]
.pom.xml
----
<?xml version="1.0" encoding="UTF-8"?>
<project>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-dependencies</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Include all needed camel-xxx-starter modules -->
</dependencies>
...
</project>
----

The `camel-spring-boot-dependencies` BOM includes Camel modules
and all transitive dependencies that have no conflicts with the spring-boot BOM.
Expand Up @@ -472,7 +472,7 @@ private static File createUserPom(ITestConfig config, List<String> cleanTestProv
Matcher m = propPattern.matcher(pom);
while (m.find()) {
String property = m.group();
String resolved = DependencyResolver.resolveParentProperty(property);
String resolved = DependencyResolver.resolveModuleOrParentProperty(new File(new File(config.getModuleBasePath()), "pom.xml"), property);
resolvedProperties.put(property, resolved);
}

Expand Down
Expand Up @@ -77,6 +77,18 @@ public static List<String> getDependencies(String pom, String scope) throws Exce
return dependencies;
}

public static String resolveModuleOrParentProperty(File modulePom, String property) {
property = resolveProperty(modulePom, property, 0);
if (property != null && !isResolved(property)) {
property = resolveSpringBootParentProperty(property);
}
if (property != null && !isResolved(property)) {
property = resolveCamelParentProperty(property);
}

return property;
}

public static String resolveParentProperty(String property) {
property = resolveSpringBootParentProperty(property);
if (property != null && !isResolved(property)) {
Expand Down

0 comments on commit 1e16019

Please sign in to comment.