= Spring Cloud Stream & Task Maven Metadata Plugin

Maven plugin for aggregating Spring Boot metadata from all dependencies of a project into a single metadata-only artifact.

== Usage

To use this plugin, configure this plugin for your app project:
[source, xml]
----
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dataflow-apps-metadata-plugin</artifactId>
            <version>1.1.0-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>aggregate-metadata</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>aggregate-metadata</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
----

This will produce and attach to the build a jar file named `<artifactId>-<version>-metadata.jar` where the `metadata` suffix is the maven classifier and can be customized as follows:
[source, xml]
----
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dataflow-apps-metadata-plugin</artifactId>
            <version>1.1.0-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>aggregate-metadata</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>aggregate-metadata</goal>
                    </goals>
                    <configuration>
                        <classifier>mymetadata</classifier>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
----

The gathered metadata can be filtered and stored into a java properties file named `META-INF/spring-configuration-metadata-encoded.properties`.
The file includes a single property named `org.springframework.cloud.dataflow.spring.configuration.metadata.json` which contains the filtered metadata encoded as Base64.

To activate the feature, set the `storeFilteredMetadata` configuration option to `true`.
Use the `metadataFilter` configuration option to specify the metadata to include.

The following example includes the `server.port` property and all properties from two configuration properties classes:
[source, xml]
----
<build>
  <plugins>
      <plugin>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dataflow-apps-metadata-plugin</artifactId>
        <version>1.1.0-SNAPSHOT</version>
        <configuration>
          <storeFilteredMetadata>true</storeFilteredMetadata>
          <metadataFilter>
            <names>
              <filter>server.port</filter>
            </names>
            <sourceTypes>
              <filter>com.example.MyConfigProperties</filter>
              <filter>com.example.MyOtherConfigProperties</filter>
            </sourceTypes>
          </metadataFilter>
        </configuration>
        <executions>
          <execution>
            <id>aggregate-metadata</id>
            <phase>compile</phase>
            <goals>
              <goal>aggregate-metadata</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
  </plugins>
</build>
----
