Validate Camel routes with fabric8 maven plugin

One of the coolest things you can do with Fabric8 Maven plugin is the validation of Camel routes which can be done in your favorite IDE or with as little as a shell

Let's see a quick example of it. We will use any of the examples provided with Camel distribution such as the camel-example-jdbc. Move to the folder where the pom.xml is and issue:

$ mvn compile -DshowAll=true compile io.fabric8.forge:fabric8-camel-maven-plugin:2.3.80:validate

 The output will show all the routes which have been inspected and the validation result:

[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:54)


[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:63)


[WARNING] Endpoint validation error at: META-INF.spring.camel-context(camel-context.xml:64)


	             showHeaders    Unknown option

[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:70)


[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:76)


[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:79)


[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:80)


[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:84)


[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:93)


[INFO] Endpoint validation passsed at: META-INF.spring.camel-context(camel-context.xml:97)


[WARNING] Endpoint validation error: (9 = passed, 1 = invalid, 0 = incapable, 0 = unknown components)
[INFO] Simple validation passed at: META-INF.spring.camel-context(camel-context.xml:78)


[INFO] Simple validation passed at: META-INF.spring.camel-context(camel-context.xml:86)


[INFO] Simple validation passed at: META-INF.spring.camel-context(camel-context.xml:95)

	Record ID=${headers.camelTestId} has been marked as 'DONE'

[INFO] Simple validation success: (3 = passed, 0 = invalid)

 Let's test for  example what happens if we include a typo in any of the above rules:

[WARNING] Endpoint validation error at: META-INF.spring.camel-context(camel-context.xml:63)


	XXuseHeadersAsParameters    Unknown option. Did you mean: [useHeadersAsParameters, allowNamedParameters]

 As you can see, the plugin even suggests potential matches with other parameters or components!

 You can also enable the plugin to automatic run as part of the build to catch errors by including in your pom.xml file:




Cookie Alert