Usage

Modify your project POM to look something like this:

<project ...>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>net.sf.qxs</groupId>
        <artifactId>project-info-plugin</artifactId>
        <version>1.0.8</version>
        <configuration>
          <!--
            The following configuration parameters are allowed:

              sourceDir (optional)
                Directory of the source tree where generated code is written to.

              className (optional)
                Name of the generated Java class.

              properties (mandatory)
                A set of key/value pairs which will be attribute/value pairs
                in the generated class.
          -->
          <!--
          <sourceDir>${project.basedir}/src/main/java</sourceDir>
          <className>${project.groupId}.ProjectInfo</className>
          -->
          <properties>
            <!--
              Add arbitrary key/value pairs here to access them from your
              source code...
            -->
            <title>${project.name}</title>
            <version>${project.version}</version>
            <foo>bar</foo>
          </properties>
        </configuration>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals><goal>generate-project-info</goal></goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <pluginRepositories>
    <pluginRepository>
      <id>qxs.sourceforge.net</id>
      <name>QXS Plugin Repository</name>
      <url>http://downloads.sourceforge.net/project/qxs/m2repo</url>
      <snapshots><enabled>false</enabled></snapshots>
      <releases><updatePolicy>never</updatePolicy></releases>
    </pluginRepository>
  </pluginRepositories>
</project>

Change the configuration according to your needs. Next, generate the ProjectInfo class:

mvn generate-sources

Note that there is usually no need for calling the generate-sources target explicitly. Check out your new ProjectInfo class. It should look like this:

package com.example;

import java.util.Date;

public final class ProjectInfo
{
  public static final Date compiled = new Date(1282066069704L);
  public static final String title = "Example Project Name";
  public static final String version = "1.0";
  public static final String foo = "bar";
}