Thanks Wayne.

I tried the exe plugin and it did what I was looking for, but I noticed
it repeated the execution few times and not just one time as needed! 

I've a Maven project that consists of a number of Maven modules, and I
put the following code in the <build> block of the Parent pom.xml:

            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <executions>
                <execution>
                  <goals>
                    <goal>exec</goal>
                  </goals>
                </execution>
              </executions>
              <configuration>
                <executable>Process_Files.cmd</executable>
              </configuration>
            </plugin> 

To execute the above code, I run the following command from a DOS
window:

mvn exec:exec -Dexec.executable="Process_Files.cmd"

So, it run this file a number of times equal the number of the Maven
modules specified in the parent pom.xml file.

Is there is a way where I can restrict the execution of this exe to just
one time?

   Thanks,

      Sameh

-----Original Message-----
From: Wayne Fay [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 11, 2008 10:00 PM
To: Maven Users List
Subject: Re: How to run a script from a pom.xml file?

Alternatively, if you're on Windows, you can add a file
mavenrc_pre.bat and mavenrc_post.bat to your user home directory and
Maven will run them before/after running the Maven build process.

But this runs for all builds (not just a specific project) and
requires that you distribute these batch/shell script files to every
developer and every server where you are executing Maven, so it is far
from ideal.

Yet another option is to modify the mvn.bat or mvn files themselves.
This also requires you to distribute the modified shell script.

The exec plugin, as previously mentioned, is a good option as well.
Assuming the binaries are the same on all your platforms (or you can
tweak with profiles) and you figure out which phase you want to invoke
it in, it should work.

What you choose really depends on what you're trying to do and why.
More details about your specific use case might produce better
comments.

Wayne

On 3/11/08, Olivier Dehon <[EMAIL PROTECTED]> wrote:
> Look for the exec plugin.
>
> -Olivier
>
> On Tue, 2008-03-11 at 19:45 -0500, Tawfik, Sameh E wrote:
> > How to run a perl or batch file at the beginning of the build?
> >
> > Is there is a command or a plugin I can use to run an external
process
> > then come back to the build when this process is complete?
> >
> > I'm using:
> >
> > Maven version: 2.0.7
> > Java version: 1.6.0_02-ea
> > OS name: "windows xp" version: "5.1" arch: "x86"
> >
> >  Thanks,
> >
> >    Sameh
> > This email and any files transmitted with it are confidential,
proprietary
> > and intended solely for the individual or entity to whom they are
addressed.
> > If you have received this email in error please delete it
immediately.
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to