Generating Properties Metadata

To generate the properties metadata in the META-INF/smartics-properties folder of the Java archive, add the following plugin configuration to your POM:

<plugin>
  <groupId>de.smartics.properties</groupId>
  <artifactId>smartics-properties-maven-plugin</artifactId>
  <version>0.2.0</version>
  <executions>
    <execution>
      <id>properties-xml-export</id>
      <goals>
        <goal>xml-export</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Generating Properties Metadata for Tests

To generate the properties metadata for tests, the test compile path (addTest) has to be activated. Since this path contains the compile path of the main classes, you usually want to deactivate the main path (addMain) in this case.

<plugin>
  <groupId>de.smartics.properties</groupId>
  <artifactId>smartics-properties-maven-plugin</artifactId>
  <version>0.2.0</version>
  <executions>
    <execution>
      <id>properties-xml-export</id>
      <phase>test-compile</phase>
      <goals>
        <goal>xml-export</goal>
      </goals>
      <configuration>
        <addMain>false</addMain>
        <addTest>true</addTest>
        <outputDirectory>
          ${project.build.testOutputDirectory}/META-INF/smartics-properties
        </outputDirectory>
      </configuration>
    </execution>
    <execution>
      <id>properties-export</id>
      <goals>
        <goal>properties-export</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Please note that the phase is set to test-compile. Otherwise the class - not yet compiled - will not be found. The outputDirectory is also changed to that of the test classes.

To create an archive of your test classes use the Maven Jar Plugin:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>test-jar</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Creating Default Java Properties Files

To generate a properties file that contains the properties of the project with their default values, use this:

<plugin>
  <groupId>de.smartics.properties</groupId>
  <artifactId>smartics-properties-maven-plugin</artifactId>
  <version>0.2.0</version>
  <executions>
    <execution>
      <id>properties-export</id>
      <goals>
        <goal>properties-export</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Add a Properties Report to the Site

To add a report on the properties declared in a project to a Maven site, add the plugin to the site plugin's configuration of report plugins.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <configuration>
    <reportPlugins>
      ...
      <plugin>
        <groupId>de.smartics.properties</groupId>
        <artifactId>smartics-properties-maven-plugin</artifactId>
        <version>0.2.0</version>
      </plugin>
      ...
    </reportPlugins>
  </configuration>
</plugin>