Fork me on GitHub

Require Contributor Roles

This rule checks that certain roles in a project are represented by contributors.

Say you want to enforce a policy that in every project there is at least one contributor representing a specific role, e.g. at least one contributor has the role "business engineer".

The following parameters are supported by this rule:

  • requiredRoles - Comma separated list of roles which must be represented by at least one contributor.
  • validRoles - Comma separated list of roles which are additionally allowed. requiredRoles are always valid, so the union of requiredRoles and validRoles forms the set of all accepted roles. By default it has the value *, which means every role is accepted. This rule does not support Ant-patterns.

Sample Plugin Configuration:

<project>
  <groupId>company</groupId>
  <artifactId>company-parent-pom</artifactId>
  <version>1.0</version>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.4.1</version> <!-- find the latest version at http://maven.apache.org/plugins/maven-enforcer-plugin/ -->
        <executions>
          <execution>
            <id>enforce-require-roles</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireContributorRoles>
                  <requiredRoles>business engineer, quality manager</requiredRoles>
                  <validRoles>java developer</validRoles>
                </requireContributorRoles>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>extra-enforcer-rules</artifactId>
            <version>1.8.0</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

Trademarks

Apache, Apache Maven, Maven and the Apache feather logo are trademarks of The Apache Software Foundation.