Thank you Brian!

I did a cop-out for now, and am doing

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <id>check-espresso-path</id>
      <phase>validate</phase>
      <configuration>
        <tasks>
          <available property="espresso-found" file="${espresso.bin}"
type="dir"/>
          <fail message="espresso.bin, '${espresso.bin}', does not point to
an existing directory.  Please fix this where you define espresso.bin (
pom.xml, profiles.xml, or ~/.m2/settings.xml)">
            <condition>
              <isfalse value="${espresso-found}" />
            </condition>
          </fail>
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>

I'm planning to make an enforcer rule sometime next week.

Also, the verifier plugin looks similar to the enforcer (except different
default phase, semantics, and capabilities).  I'm a bit curious about
that...  But anyway, since enforcer seems more powerful (no pun inteded :),
it would be nice to copy the file checking of maven-verify-plugin into
maven-enforcer-plugin(-rule??).  I think I will try that.

Thanks again!

-- Dan


On 10/28/07, Brian E. Fox <[EMAIL PROTECTED]> wrote:
>
> Enforcer plugin was designed exactly for these kinds of things. It
> shouldn't be hard to create that rule.
>
> -----Original Message-----
> From: Dan Kigelman [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 28, 2007 3:39 PM
> To: Maven Users List
> Subject: Best Way to Enforce a File Exists
>
> Hello,
>
> I am wondering what is the proper/best way to make sure a certain
> (executable) file exists on a system.
>
> I am working with a service that executes a certain command (pw.x) when
> nicely asked to.  I'm finding that it is quite a pain to make sure that
> everything is setup correctly for the service (paths, working
> directories,
> etc).  It would be easier if there was an automatic way to check the
> setup
> is correct. What is the best way to do that?  I see a few options:
>
> 1)  a unit-test that asserts that a path defined in the pom.xml (or
> settings.xml, or profiles.xml) exists
>
> 2)  using the maven-enforcer-plugin to assert the existence of that
> directory before building (this involves writing a custom enforcer rule
> I
> think).
>
> 3)  same as 2) except writing an ant script to be executed by the
> maven-antrun-plugin that checks the same thing
>
>
> Has anyone encountered this decision before?  (Or have any thoughts on
> the
> issue?)
>
> I'm thinking #2 (or #3 for laziness/proof-of-concept) would be best, but
> there could be other issues, like building on one system and deploying
> on
> another...
>
> Suggestions and ideas would be much appreciated!
>
> Thank you,
>
> -- Dan Kigelman
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to