需要环境变量

此规则检查是否设置了指定的环境变量。

此规则支持以下参数:

  • message - 如果规则失败,则向用户发送可选消息。
  • variableName - 要检查的环境变量的名称。

示例插件配置:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>enforce-environment-variable-is-set</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireEnvironmentVariable>
                  <variableName>the_name_you_wish_to_be_checked</variableName>
                </requireEnvironmentVariable>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>