Skip to content

Commit

Permalink
Add documentation of maven plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
agentgt committed Dec 27, 2024
1 parent bdadc96 commit 1862256
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
54 changes: 54 additions & 0 deletions doc/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,60 @@ <h3 id="keyvaluessystem">KeyValuesSystem</h3>
<p>This is the entry point into Ezkv and is used to load the initial part of the chain of resources.
The bootstrapping part of your application will call it first and will often convert or pass the loaded key values to another system.</p>

<h2 id="extensions">Extensions and Integration</h2>

Most of the modules are explained below in the <a href="#all-modules-table">modules table</a>.

<h3 id="maven-plugin">Maven Plugin</h3>

EZKV has a maven plugin that will load config as properties in a Maven build.

This plugin is similar to <a href=
"https://www.mojohaus.org/properties-maven-plugin/">properties-maven-plugin</a> except
that it will use EZKV to load the properties. Unlike the Codehaus properties plugin
this plugin allows chain loading of config.
<p>
However like the Codehaus properties plugin this plugin has the following limitations:
</p>
<p>
This plugin (as all other) is executed in the later phase - when project model is
already build in memory.
</p>
<p>
So properties read from external files by this plugin can not by used in project
definitions in items like {@code <goal>}, {@code <version>} and so on.
</p>
<p>
Properties read by plugin in one module are not propagated to other modules or child
projects.
</p>
<p>
Properties are only available for other plugins in runtime like for
maven-resource-plugin for filtering resources.
</p>

<strong>Example:</strong>

{@snippet lang = xml :
<plugin>
<groupId>io.jstach.ezkv</groupId>
<artifactId>ezkv-maven-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-config</goal>
</goals>
<configuration>
<urls>
<!-- Note that maven will interpolate first if you have variables in the url -->
<url>file:///${project.basedir}/src/main/resources/db/database.properties</url>
</urls>
</configuration>
</execution>
</executions>
</plugin>
}

</div>
</body>
Expand Down
26 changes: 25 additions & 1 deletion ezkv-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -34,4 +35,27 @@
<version>3.15.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>io.jstach.ezkv.maven</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>doc</id>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
</profile>
</profiles>
</project>

0 comments on commit 1862256

Please sign in to comment.