title: How to enforce that a property is set that points to a base directory for systemPath?
body: <p>I'm trying to enforce that a property is set using the maven enforcer plugin. The property should point to a directory and is used as a base directory for some system scope dependencies. I have the following <code>pom.xml</code>:</p>
  
  <pre><code>&lt;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"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;org.example&lt;/groupId&gt;
      &lt;artifactId&gt;maven-enforcer-systempath&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.example&lt;/groupId&gt;
              &lt;artifactId&gt;bar&lt;/artifactId&gt;
              &lt;version&gt;1.0.0&lt;/version&gt;
              &lt;scope&gt;system&lt;/scope&gt;
              &lt;systemPath&gt;${non.existent.property}/bar.jar&lt;/systemPath&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-enforcer-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.4.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;enforce-property&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;enforce&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;phase&gt;validate&lt;/phase&gt;
                          &lt;configuration&gt;
                              &lt;rules&gt;
                                  &lt;requireProperty&gt;
                                      &lt;property&gt;non.existent.property&lt;/property&gt;
                                      &lt;message&gt;"non.existent.property" must point to a directory&lt;/message&gt;
                                  &lt;/requireProperty&gt;
                              &lt;/rules&gt;
                              &lt;fail&gt;true&lt;/fail&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Now when I run the project with property <code>non.existent.property</code> not being set, I get the following output:</p>
  
  <pre><code>[INFO] Scanning for projects...
  [ERROR] [ERROR] Some problems were encountered while processing the POMs:
  [ERROR] 'dependencies.dependency.systemPath' for org.example:bar:jar must specify an absolute path but is ${non.existent.property}/bar.jar @ line 14, column 16
   @ 
  [ERROR] The build could not read 1 project -&gt; [Help 1]
  [ERROR]   
  [ERROR]   The project org.example:maven-enforcer-systempath:0.0.1-SNAPSHOT (C:\Users\workingcopy\maven-enforcer-systempath\pom.xml) has 1 error
  [ERROR]     'dependencies.dependency.systemPath' for org.example:bar:jar must specify an absolute path but is ${non.existent.property}/bar.jar @ line 14, column 16
  [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/ProjectBuildingException
  </code></pre>
  
  <p>The reported error appears before the enforcer plugin is invoked. I believe this is because the <a href="http://maven.apache.org/enforcer/maven-enforcer-plugin/enforce-mojo.html" rel="nofollow noreferrer">documentation of the enforce goal</a> states:</p>
  
  <blockquote>
    <p>Requires dependency collection of artifacts in scope: test.</p>
  </blockquote>
  
  <p>How can I enforce that the property is set before dependencies are collected?</p>