Skip to content

reqstool/reqstool-java-maven-plugin

Commit Activity GitHub Issues License Build Documentation

Reqstool Maven Plugin

Maven build plugin for reqstool that assembles requirements traceability artifacts.

Overview

Collects @Requirements and @SVCs annotations from compiled Java code, combines them with test results, and packages everything into a ZIP artifact for analysis by the reqstool CLI.

The plugin binds to the verify lifecycle phase and runs automatically after tests complete. No additional lifecycle configuration is needed in most projects.

Installation

Add the plugin to your pom.xml:

<plugin>
    <groupId>io.github.reqstool</groupId>
    <artifactId>reqstool-maven-plugin</artifactId>
    <version>1.0.4</version>
    <executions>
        <execution>
            <goals>
                <goal>assemble-and-attach-zip-artifact</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <datasetPath>${project.basedir}/docs/reqstool</datasetPath>
    </configuration>
</plugin>

Configuration

All parameters are optional. Defaults match the standard Maven project layout.

Parameter Type Default Description
requirementsAnnotationsFile File ${project.build.directory}/generated-sources/annotations/resources/annotations.yml Requirements annotations YAML file generated by the annotation processor for the main source set
svcsAnnotationsFile File ${project.build.directory}/generated-test-sources/test-annotations/resources/annotations.yml SVCs annotations YAML file generated by the annotation processor for the test source set
outputDirectory File ${project.build.directory}/reqstool Output directory for the ZIP artifact and combined annotations file
datasetPath File ${project.basedir}/reqstool Directory containing requirements.yml and optional supporting files
testResults String[] (none) Ant-style glob patterns for test result XML files to include in the ZIP
skip boolean false Skip all plugin execution
skipAssembleZipArtifact boolean false Skip ZIP assembly; annotations are still combined into annotations.yml
skipAttachZipArtifact boolean false Skip attaching the ZIP artifact to the Maven project

Dataset directory

The datasetPath directory must contain at minimum a requirements.yml file. Optional files in the same directory are included if present:

File Required
requirements.yml Yes
software_verification_cases.yml No
manual_verification_results.yml No

Full configuration example

<plugin>
    <groupId>io.github.reqstool</groupId>
    <artifactId>reqstool-maven-plugin</artifactId>
    <version>1.0.4</version>
    <executions>
        <execution>
            <goals>
                <goal>assemble-and-attach-zip-artifact</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <requirementsAnnotationsFile>
            ${project.build.directory}/generated-sources/annotations/resources/annotations.yml
        </requirementsAnnotationsFile>
        <svcsAnnotationsFile>
            ${project.build.directory}/generated-test-sources/test-annotations/resources/annotations.yml
        </svcsAnnotationsFile>
        <outputDirectory>${project.build.directory}/reqstool</outputDirectory>
        <datasetPath>${project.basedir}/docs/reqstool</datasetPath>
        <testResults>
            <testResult>target/surefire-reports/**/*.xml</testResult>
            <testResult>target/failsafe-reports/**/*.xml</testResult>
        </testResults>
        <skip>false</skip>
        <skipAssembleZipArtifact>false</skipAssembleZipArtifact>
        <skipAttachZipArtifact>false</skipAttachZipArtifact>
    </configuration>
</plugin>

Command-line overrides

All parameters can be overridden on the command line using the reqstool. prefix:

mvn verify -Dreqstool.skip=true
mvn verify -Dreqstool.datasetPath=/custom/path
mvn verify -Dreqstool.skipAssembleZipArtifact=true

Goal reference

assemble-and-attach-zip-artifact

Default phase: verify

Combines requirements and SVCs annotations, writes a merged annotations.yml to outputDirectory, and (unless skipAssembleZipArtifact is set) assembles a ZIP artifact at <outputDirectory>/<finalName>-reqstool.zip. The ZIP is attached to the Maven project with classifier reqstool and extension zip.

Usage

mvn clean verify

The plugin generates a ZIP artifact in target/reqstool/ containing requirements, annotations, and test results.

Documentation

Full documentation can be found here.

Contributing

See the organization-wide CONTRIBUTING.md.

License

MIT License.

Contributors

Languages