[
https://issues.apache.org/jira/browse/MENFORCER-320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Shesterov updated MENFORCER-320:
-------------------------------------
Description:
The {{RequireProfileIdsExist}} rule introduced by MENFORCER-282 fails if Maven
is invoked without any active profiles and no profiles are defined in the
{{pom.xml}} itself.
This particularly applies to multi-module projects where all the profiles are
defined in the parent pom — there's no way to build a single module separately
in this case.
An example which demonstrates the problem:
{code:java|title=pom.xml}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProfileIdsExist/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
{code}
{code:java|title=terminal}
$mvn validate
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.example:parent >-------------------------
[INFO] Building parent 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (default) @ parent ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireProfileIdsExist
failed with message:
The requested profile doesn't exist:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.563 s
[INFO] Finished at: 2018-10-05T14:00:35+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (default) on
project parent: Some Enforcer rules have failed. Look above for specific
messages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
{code}
was:
The {{RequireProfileIdsExist}} rule introduced by MENFORCER-282 fails if Maven
is invoked without any active plugins.
An example which demonstrates the problem:
{code:title=pom.xml}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProfileIdsExist/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
{code}
{code:title=terminal}
$mvn validate
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.example:parent >-------------------------
[INFO] Building parent 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (default) @ parent ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireProfileIdsExist
failed with message:
The requested profile doesn't exist:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.563 s
[INFO] Finished at: 2018-10-05T14:00:35+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (default) on
project parent: Some Enforcer rules have failed. Look above for specific
messages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
{code}
> RequireProfileIdsExist check fails if no profiles have been specified
> ---------------------------------------------------------------------
>
> Key: MENFORCER-320
> URL: https://issues.apache.org/jira/browse/MENFORCER-320
> Project: Maven Enforcer Plugin
> Issue Type: Bug
> Components: Standard Rules
> Affects Versions: 3.0.0-M2
> Reporter: Alex Shesterov
> Priority: Major
>
> The {{RequireProfileIdsExist}} rule introduced by MENFORCER-282 fails if
> Maven is invoked without any active profiles and no profiles are defined in
> the {{pom.xml}} itself.
> This particularly applies to multi-module projects where all the profiles are
> defined in the parent pom — there's no way to build a single module
> separately in this case.
> An example which demonstrates the problem:
> {code:java|title=pom.xml}
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>com.example</groupId>
> <artifactId>parent</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-enforcer-plugin</artifactId>
> <version>3.0.0-M2</version>
> <executions>
> <execution>
> <goals>
> <goal>enforce</goal>
> </goals>
> <configuration>
> <rules>
> <requireProfileIdsExist/>
> </rules>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> </project>
> {code}
> {code:java|title=terminal}
> $mvn validate
> [INFO] Scanning for projects...
> [INFO]
> [INFO] -------------------------< com.example:parent
> >-------------------------
> [INFO] Building parent 1.0.0-SNAPSHOT
> [INFO] --------------------------------[ jar
> ]---------------------------------
> [INFO]
> [INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (default) @ parent ---
> [WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireProfileIdsExist
> failed with message:
> The requested profile doesn't exist:
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 0.563 s
> [INFO] Finished at: 2018-10-05T14:00:35+02:00
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (default) on
> project parent: Some Enforcer rules have failed. Look above for specific
> messages explaining why the rule failed. -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions, please
> read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)