Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
.mvn
src
LICENSE
README.adoc
mvnw
mvnw.cmd
pom.xml

README.adoc

spring-cloud-stream-app-maven-plugin

Build

mvn clean package [Requires JDK 8]

Sample Configuration for generating spring cloud stream apps

and for Spring Cloud Task Apps it is at:

    <plugin>
        <groupId>org.springframework.cloud.stream.app.plugin</groupId>
        <artifactId>spring-cloud-stream-app-maven-plugin</artifactId>
        <version>1.0.0.BUILD-SNAPSHOT</version>
            <configuration>
                <generatedProjectHome>/tmp</generatedProjectHome>
                <generatedProjectVersion>${project.version}</generatedProjectVersion>
                <applicationType>stream</applicationType>
                <bom>
                    <name>scs-bom</name>
                    <groupId>org.springframework.cloud.stream.app</groupId>
                    <artifactId>spring-cloud-stream-app-dependencies</artifactId>
                    <version>${project.version}</version>
                </bom>

                <binders>
                    <kafka />
                    <rabbit />
                </binders>
                <generatedApps>
                <time-source />
                    <transform-processor />
                    <trigger-source />
                    <file-sink />
                </generatedApps>
            </configuration>
    </plugin>

Binders are only applicable for spring cloud stream apps. They are not required for spring cloud task apps.

Application type must be stream and task for stream and task apps respectively.

The bom for stream apps is specified in spring-cloud-stream-app-dependencies (group id: org.springframework.cloud.stream.app)

and for tasks it is spring-cloud-task-app-dependencies (group id: org.springframework.cloud.task.app).

Extra dependency management can be added as additional boms to the plugin using the property -DbomsWithHigherPrecedence and value based on the pattern groupId:artfiactId:version. This can be a comma separated collection of boms. Any bom added like this will get priority in the order they are specified over any default values used in the plugin configuration.

Spring Boot version used in the generated app can be overridden using the plugin property
-DbootVersion=<spring boot version>.

Copy Third-Party Resources

The copyResources configuration block permits copying Resources from third-party jar dependencies into the generated App Starter classpath.

Form example if you want to copy a truststore and a self-signed certificate (clientKeyStore.jks, cacerts) bundled inside the org.springframework.cloud.stream.app:coap-app-starters-common:2.0.0.BUILD-SNAPSHOT dependency you can add this to the spring-cloud-stream-app-maven-plugin configuration:

			<plugin>
				<groupId>org.springframework.cloud.stream.app.plugin</groupId>
				<artifactId>spring-cloud-stream-app-maven-plugin</artifactId>
				<configuration>
					<generatedProjectHome>${session.executionRootDirectory}/apps</generatedProjectHome>
					<generatedProjectVersion>${project.version}</generatedProjectVersion>
					<bom>....</bom>
					<generatedApps>
						<coap-server-source/>
					</generatedApps>
					<copyResources>
						<copyResource>
                             <groupId>org.springframework.cloud.stream.app</groupId>
                             <artifactId>coap-app-starters-common</artifactId>
                             <version>2.0.0.BUILD-SNAPSHOT</version>
                             <includes>clientKeyStore.jks,cacerts</includes>
						</copyResource>
					</copyResources>
				</configuration>
			</plugin>
		</plugins>

Later will add the following maven-dependency-plugin definition to the generated aps starter pom:

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.springframework.cloud.stream.app</groupId>
                  <artifactId>coap-app-starters-common</artifactId>
                  <version>2.0.0.BUILD-SNAPSHOT</version>
                  <includes>clientKeyStore.jks,cacerts</includes>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/classes/</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

This will ensure that the clientKeyStore.jks,cacerts files will be copied to the AppStarter’s BOOT-INF/classes/

Insert additional properties into the application.properties file for the created app.

The additionalAppProperties configuration block permits adding of additional properties to the application.properties file.

<plugin>
    <groupId>org.springframework.cloud.stream.app.plugin</groupId>
    <artifactId>spring-cloud-stream-app-maven-plugin</artifactId>
    <configuration>
        <generatedProjectHome>${session.executionRootDirectory}/apps</generatedProjectHome>
        <generatedProjectVersion>${project.version}</generatedProjectVersion>
        <bom>....</bom>
        <generatedApps>
            <coap-server-source/>
        </generatedApps>
        <additionalAppProperties>
            <additionalAppProperty>spring.cloud.task.closecontextEnabled=true</additionalAppProperty>
        </additionalAppProperties>
    </configuration>
    </configuration>
</plugin>

In the example above we added the`spring.cloud.task.closecontextEnabled` property to the application.properties of the created app.