Java Version Control

Allow builds to fail quickly if the Java version is not correct.

Require a specific Java version

This will only allow the build to function if the Java version is 1.4.1, any other version will cause a build failure.

NOTE: That for 1.4.1 you specify 1.41. The version should have only one decimal.

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>require-java-version</goal>
            </goals>
            <configuration>
                <version>1.41</version>
            </configuration>
        </execution>
    </executions>
</plugin>

Require Java version greater than or equal

Specify the '+' token as a suffix to the version number.

This will only allow the build to function if the Java version is 1.4 or grater.

For example 1.4.1 or 1.5, but not 1.3.

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>require-java-version</goal>
            </goals>
            <configuration>
                <version>1.4+</version>
            </configuration>
        </execution>
    </executions>
</plugin>

Require Java version in the same group

Specify the '*' token as a suffix to the version number.

This will only allow the build to function if the Java version is 1.4 or grater in the same group.

For example 1.4.1 or 1.4.2, but not 1.5.

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>require-java-version</goal>
            </goals>
            <configuration>
                <version>1.4*</version>
            </configuration>
        </execution>
    </executions>
</plugin>

Maven Version Control

Allow builds to fail quickly if the Maven version is not correct.

Require a specific Maven version

This will only allow the build to function if the Maven version is 2.0.4, any other version will cause a build failure.

NOTE: The basic syntax is the same as for require-java-version, except that you can specify values like 1.4.1 (you do not need to, or should, specify 1.41).

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>require-maven-version</goal>
            </goals>
            <configuration>
                <version>2.0.4</version>
            </configuration>
        </execution>
    </executions>
</plugin>

Other Tools

Copy legal files

Copy LICENSE[.txt], NOTICE[.txt] and DISCLAIMER[.txt]. to target/classes/META-INF for inclusion into archives.

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>install-legal-files</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>copy-legal-files</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The list of files to include can be configured explicitly if desired.

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>install-legal-files</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>copy-legal-files</goal>
            </goals>
            <configuration>
                <fileset>
                    <basedir>${pom.basedir}</basedir>
                    <includes>
                        <include>*.txt</include>
                    </includes>
                </fileset>
            <configuration>
        </execution>
    </executions>
</plugin>

Verify that artifacts include legal files

Help to make sure that your generated project artifacts (and attached artifacts), which are zip-encoded include required legal files.

By default checks for LICENSE.txt and NOTICE.txt in META-INF/ and artifactId-version/:

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>verify-legal-files</id>
            <phase>verify</phase>
            <goals>
                <goal>verify-legal-files</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Fail builds using strict mode:

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>verify-legal-files</id>
            <phase>verify</phase>
            <goals>
                <goal>verify-legal-files</goal>
            </goals>
        </execution>
        <configuration>
            <strict>true</strict>
        </configuration>
    </executions>
</plugin>

Specify the list of required legal files:

<plugin>
    <groupId>org.apache.geronimo.genesis.plugins</groupId>
    <artifactId>tools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>verify-legal-files</id>
            <phase>verify</phase>
            <goals>
                <goal>verify-legal-files</goal>
            </goals>
        </execution>
        <configuration>
            <requiredFiles>
                <requiredFile>LICENSE.txt</requiredFile>
                <requiredFile>NOTICE.txt</requiredFile>
                <requiredFile>DISCLAIMER.txt</requiredFile>
            </requiredFiles>
        </configuration>
    </executions>
</plugin>