= spring-cloud-dataflow-apps-generator-plugin
Maven plugin for generating spring cloud stream applications: https://github.com/spring-cloud/stream-applications
It generates a separate maven project for every configured binder.
Plugin `Application` section helps to configure the application project independently form the Binders that
can be used. The `Binders` section helps to define the Binder specific configurations, that are merged to
the `Application` configurations to generate the binder specific maven projects.
The `Global` section (e.g. `global.application` and `global.binders`) helps to define configurations sharable
between many Applications and Binders.
As the following diagram illustrates, both the `Application` and the
`Binder` allow configuring various application and maven properties:
image::src/main/resources/doc/MojoConfiguration.jpg[]
== Build
mvn clean package [Requires JDK 8]
== Sample Configuration for generating spring cloud stream apps
In the parent POM define the `Application` and `Binder` configurations common for all applications to be generated.
Do this under the `pluginManagement` pom section and use the plugin's `global` configuration:
[source, xml]
----
org.springframework.cloud
spring-cloud-dataflow-apps-generator-plugin
1.0.0-SNAPSHOT
app-gen
package
generate-app
${basedir}/apps
${spring-boot.version}
true
2.0.2.BUILD-SNAPSHOT
org.springframework.cloud.fn
function-dependencies
${java-functions.version}
org.springframework.cloud
spring-cloud-stream-dependencies
${spring-cloud-stream-dependencies.version}
org.springframework.cloud
spring-cloud-function-dependencies
${spring-cloud-function-dependencies.version}
org.springframework.cloud
spring-cloud-dependencies
${spring-cloud-dependencies.version}
org.springframework.cloud.stream.app
stream-applications-security-common
org.springframework.cloud.stream.app
stream-applications-micrometer-common
org.springframework.cloud.stream.app
stream-applications-postprocessor-common
io.micrometer
micrometer-registry-prometheus
io.micrometer.prometheus
prometheus-rsocket-spring
io.micrometer
micrometer-registry-wavefront
io.pivotal.cfenv
java-cfenv-boot
org.springframework.boot
spring-boot-configuration-processor
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-starter-security
org.springframework.cloud
spring-cloud-stream-binder-kafka
org.springframework.cloud
spring-cloud-stream-binder-rabbit
----
Above global configurations will be reused by all children applications.
In addition, the child application can add application specific configurations, contributed to the inherited from
to the global:
[source, xml]
----
org.springframework.cloud
spring-cloud-dataflow-apps-generator-plugin
1.0.0-SNAPSHOT
syslog
source
${project.version}
org.springframework.cloud.fn.supplier.syslog.SyslogSupplierConfiguration.class
org.springframework.cloud.fn
syslog-supplier
org.springframework.cloud.stream.app
stream-applications-composite-function-support
${stream-apps-core.version}
...
----
== Configure Solace and Pubsub binders support
To generate applications for https://github.com/SolaceProducts/spring-cloud-stream-binder-solace[Solace] binders, extend your `binders` section with following configuration:
[source, xml]
----
....
com.solace.spring.cloud
spring-cloud-starter-stream-solace
1.2.1
....
----
You can add it either to your application's POM or to the parent's `global` POM sections.
Similar to generate application for the https://github.com/spring-cloud/spring-cloud-gcp/tree/master/spring-cloud-gcp-pubsub-stream-binder[PubSub]
binders and to your binders section configuration like this:
[source, xml]
----
...
org.springframework.cloud
spring-cloud-gcp-dependencies
1.2.4.RELEASE
org.springframework.cloud
spring-cloud-gcp-pubsub-stream-binder
...
----
== Custom Spring Boot Maven Plugin Configuration
Spring Boot Maven plugin offers a number of customization options by specifying a configuration section in the plugin definition.
For example, using the custom configuration, you can instruct the plugin to unpack a particular dependency.
You would do that using Spring Boot Maven plugin as below.
```
org.springframework.boot
spring-boot-maven-plugin
org.python
jython-standalone
```
When using the app generator plugin, you can ask the plugin to include this information when it generates the necessary XML snippets for adding the Spring Boot Maven plugin.
Below is an example of doing so.
```
org.springframework.cloud
spring-cloud-dataflow-apps-generator-plugin
...
org.python
jython-standalone
]]>
...
```
Pay attention to how the Spring Boot plugin configuration is wrapped inside a `CDATA` element.
This is necessary for the app generator to properly parse this information.