Fork me on GitHub

Require Developer Roles

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

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

The following parameters are supported by this rule:

  • requiredRoles - Comma separated list of roles which must be represented by at least one developer.
  • 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>1.0</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>
                <requireDeveloperRoles>
                  <requiredRoles>lead engineer</requiredRoles>
                  <validRoles>java developer</validRoles>
                </requireDeveloperRoles>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>extra-enforcer-rules</artifactId>
            <version>1.0-beta-6</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

Trademarks

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