Skip to content

a maven plugin collecting all spring configuration properties and generating documentation for them

License

Notifications You must be signed in to change notification settings

eitco/spring-config-collector-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License

Build status Maven Central Version

spring config collector maven plugin

This maven plugin collects all spring configuration properties of the project and its dependencies and creates documentation for them, either in plain html or in asciidoc.

It does so by collection spring boots own configuration meta information files, that can be found inside jars in META-INF/spring-configuration-metadata.json.

📘 Note that this only finds configuration properties defined by classes annotated with @ConfigurationProperties. @Value configuration properties will not be found.

usage

First, add this plugin to your pom:

<plugin>
    <groupId>de.eitco.cicd</groupId>
    <artifactId>spring-config-collector-maven-plugin</artifactId>
    <version>4.0.1</version>
</plugin>

Decide whether you want to generate an adoc file or an html file, and add an execution of the corresponding goal (This example simply executes both goals):

<plugin>
    <groupId>de.eitco.cicd</groupId>
    <artifactId>spring-config-collector-maven-plugin</artifactId>
    <version>4.0.1</version>
    <executions>
        <execution>
            <id>adoc</id>
            <goals>
                <goal>adoc-overview</goal>
                <goal>html-overview</goal>
            </goals>
        </execution>
    </executions>
</plugin>

This will write the generated files to the target directory. You can specify the directory to write to using the outputDirectory parameter:

<plugin>
    <groupId>de.eitco.cicd</groupId>
    <artifactId>spring-config-collector-maven-plugin</artifactId>
    <version>4.0.1</version>
    <executions>
        <execution>
            <id>adoc</id>
            <goals>
                <goal>adoc-overview</goal>
                <goal>html-overview</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/config-documentation</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

When building the project this will create an html file and an adoc file containing information about every member of all configuration properties of your application.

This does however include spring standard properties, this might or might not be desired. Should this not be desired you can filter property names using a regular expression:

<plugin>
    <groupId>de.eitco.cicd</groupId>
    <artifactId>spring-config-collector-maven-plugin</artifactId>
    <version>4.0.1</version>
    <executions>
        <execution>
            <id>adoc</id>
            <goals>
                <goal>adoc-overview</goal>
                <goal>html-overview</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}</outputDirectory>
                <filteringRegex>my\.property\.prefix\..*|other-prefix.*</filteringRegex>
            </configuration>
        </execution>
    </executions>
</plugin>

In this case only properties that begin with my.property.prefix or other-prefix will be listed in the resulting files.

For further examples see the integration test directory.

About

a maven plugin collecting all spring configuration properties and generating documentation for them

Resources

License

Stars

Watchers

Forks

Packages

No packages published