Uploaded image for project: 'Maven Enforcer Plugin'
  1. Maven Enforcer Plugin
  2. MENFORCER-320

RequireProfileIdsExist check fails if no profiles have been specified

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.0.0-M2
    • Fix Version/s: 3.0.0-M3
    • Component/s: Standard Rules
    • Labels:
      None

      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:

      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>
      
      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
      

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alex.shesterov Alex Shesterov

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment