此规则检查指定的配置文件列表是否已激活。
此规则支持以下参数:
示例插件配置:
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>enforce-all-profiles-are-activated</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireActiveProfile> <profiles>first,second</profiles> </requireActiveProfile> </rules> <fail>true</fail> </configuration> </execution> </executions> </plugin> </plugins> </build> [...] </project>
用于检查给定配置文件之一是否处于活动状态的示例插件配置:
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>enforce-first-or-second-profile-is-active</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireActiveProfile> <profiles>first,second</profiles> <all>false</all> </requireActiveProfile> </rules> <fail>true</fail> </configuration> </execution> </executions> </plugin> </plugins> </build> [...] </project>