This is an automated email from the ASF dual-hosted git repository. oalsafi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new c313010 CAMEL-14886: Add docs about camel component maven plugin (#3898) c313010 is described below commit c313010741ab23c6396fa8fab1fd1ab7a00ff715 Author: Omar Al-Safi <omars...@gmail.com> AuthorDate: Mon Jun 8 13:15:43 2020 +0200 CAMEL-14886: Add docs about camel component maven plugin (#3898) --- docs/user-manual/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/camel-component-maven-plugin.adoc | 50 ++++++++++++++++++++++ docs/user-manual/modules/ROOT/pages/index.adoc | 2 + .../modules/ROOT/pages/writing-components.adoc | 14 +++++- 4 files changed, 66 insertions(+), 1 deletion(-) diff --git a/docs/user-manual/modules/ROOT/nav.adoc b/docs/user-manual/modules/ROOT/nav.adoc index ab64c7f..5d241b1 100644 --- a/docs/user-manual/modules/ROOT/nav.adoc +++ b/docs/user-manual/modules/ROOT/nav.adoc @@ -7,6 +7,7 @@ ** xref:camel-jar-dependencies.adoc[Camel JAR Dependencies] ** xref:camel-boot.adoc[Camel Boot] ** xref:camel-maven-plugin.adoc[Camel Maven Plugin] +** xref:camel-component-maven-plugin.adoc[Camel Component Maven Plugin] ** xref:camel-report-maven-plugin.adoc[Camel Maven Report Plugin] ** xref:camel-maven-archetypes.adoc[Camel Maven Archetypes] ** xref:configuring-camel.adoc[Configuring Camel] diff --git a/docs/user-manual/modules/ROOT/pages/camel-component-maven-plugin.adoc b/docs/user-manual/modules/ROOT/pages/camel-component-maven-plugin.adoc new file mode 100644 index 0000000..beecc2a --- /dev/null +++ b/docs/user-manual/modules/ROOT/pages/camel-component-maven-plugin.adoc @@ -0,0 +1,50 @@ += Camel Component Maven Plugin + +The +https://github.com/apache/camel/tree/master/tooling/maven/camel-component-maven-plugin[Camel Component +Maven Plugin] allows you to generate all the necessary metadata and Java classes for configurations to be used with Camel 3.x. These metadata files and Java files allows for more efficiency and faster runs for your component. + +== Goals Supported + +=== :generate +This goal will generate the following metadata files and Java files: + +* Jandex index: it will generate a Jandex index for used Java annotations within the project which allows to more efficiency to search and load the annotations to generate other metadata as mentioned below. +* Type Converter Loader: it will xref:type-converter.adoc [generate a loader for type converter] annotated with `@Converter(loader = true)` to allow faster way for Camel to load these converter. +* SPIs: it will generate all Service Provider Interfaces (SPI) for the component. This allows Camel to auto-discover your component without adding it manually to the Camel context. +* Configurers: it will generate all configurer Java classes from `@Configuer` annotated classes. +* Endpoint Schema: it will generate the property configurers as well as schema JSONs extracted from the component's Endpoint and Component classes. This allows Camel to avoid reflections while configuring the properties, thus allows for better efficiency. +* Prepare Component: it analyzes if the maven module contains Camel modules such as `components`, `dataformats`, `languages` and others. And for each of those generates extra descriptors and schema files for easier auto-discovery in Camel and tooling. +* Validate Component: it validates the Camel component if the meta-files for `components`, `dataformats`, `languages` and others, all contains the needed meta-data such as assigned labels, documentation for each option. + +[NOTE] +==== + + +In order for the plugin to work probably, you will need to have the proper Camel annotations in your component. Example, `@Component` for component class, `@UriEndpoint` for endpoint class, `@UriParams` ..etc. You can take a look at these annotation how being used in any of the existing Camel components in github. Or even better, you can use xref:camel-maven-archetypes.adoc[Camel Maven Archetypes] to bootstrap the initial component, this already include all the necessary batteries for yo [...] + +==== + +== Adding the plugin to your pom.xml + +In case you *did not* use the Camel Maven Archetypes to bootstrap the initial component project, you will need to add the following to your `pom.xml` build section: + +[source,xml] +---- +<plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-component-maven-plugin</artifactId> + <version>${camel-version}</version> + <executions> + <execution> + <id>generate</id> + <goals> + <goal>generate</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> +</plugin> +---- + +This will attach this plugin `:generate` goal to Maven's `process-classes`, in order to generate all the necessary files being describe above upon compilation. Thus, `mvn test`, `mvn package`, `mvn verify` and `mvn install` phases should run this plugin. \ No newline at end of file diff --git a/docs/user-manual/modules/ROOT/pages/index.adoc b/docs/user-manual/modules/ROOT/pages/index.adoc index 04c2d30..8f07f89 100644 --- a/docs/user-manual/modules/ROOT/pages/index.adoc +++ b/docs/user-manual/modules/ROOT/pages/index.adoc @@ -66,12 +66,14 @@ For a deeper and better understanding of Apache Camel, an xref:faq:what-is-camel * [Using CamelProxy] for how to use proxies for clients to easily invoke camel routes without them knowing * xref:camel-maven-plugin.adoc[Camel Maven Plugin] for running Camel from a Maven goal +* xref:camel-component-maven-plugin.adoc[Camel Component Maven Plugin] to generate all the necessary metadata and Java file for your custom component. * xref:camel-report-maven-plugin.adoc[Camel Maven Report Plugin] to validate your source code and report the code coverage of your camel routes * xref:camel-maven-archetypes.adoc[Camel Maven Archetypes] * xref:creating-a-new-spring-based-camel-route.adoc[Creating a new Spring based Camel Route] * xref:components::jmx-component.adoc[Camel JMX] * xref:using-osgi-blueprint-with-camel.adoc[Using OSGi blueprint with Camel] * xref:rest-dsl.adoc[Working with REST and Rest DSL] +* xref:writing-components.adoc[Writing Custom Camel Components] === xref:architecture.adoc[Architecture] diff --git a/docs/user-manual/modules/ROOT/pages/writing-components.adoc b/docs/user-manual/modules/ROOT/pages/writing-components.adoc index 8adaa1b..d0af930 100644 --- a/docs/user-manual/modules/ROOT/pages/writing-components.adoc +++ b/docs/user-manual/modules/ROOT/pages/writing-components.adoc @@ -20,7 +20,19 @@ following line -- `class=com.example.CustomComponent`. Users can then either explicitly create your component, configure it and register with a `CamelContext` or users can use a URI which auto-creates your component. -*Note:* It is recommended to bootstrap your initial component using xref:camel-maven-archetypes.adoc[Camel Maven Archetypes], as it will give you all the necessary bits to start developing your component with ease. +[NOTE] +==== + +It is recommended to bootstrap your initial component using xref:camel-maven-archetypes.adoc[Camel Maven Archetypes], as it will give you all the necessary bits to start developing your component with ease. + +==== + +[NOTE] +==== + +You will need as well to make sure to have xref:camel-component-maven-plugin.adoc[Camel Component Maven Plugin] included in your component's `pom.xml` file, order to generate all the necessary metadata and Java files for your component. + +==== [[WritingComponents-WritingEndpoints]] == Writing Endpoints