Hello,
It appears what you'd like to do is execute a process in the background
or as a deamon type process. I didn't see anything in the exec
documentation allowing this type of execution. It appears the exec
commands does indeed wait of the completion of the command before
continuing. Another idea creates a wrapper script around the command you
want to execute and execute the wrapper script from maven. If you are on
a *ix system, execute your command from the wrapper like this:

#!/bin/bash

java org.hsqldb.Server &

== Possibly add checking ensuring the DB fired up properly ==

exit 0       <=== Could also exit with a variable set based on the
proper starting of the DB

# end script

Notice the "&" starts the DB in the background. Just a thought.

HTH,
Steve

-----Original Message-----
From: Menelaos Perdikeas [mailto:[email protected]] 
Sent: Wednesday, January 27, 2010 6:43 AM
To: [email protected]
Subject: Re: [mojo-user] org.codehaus.mojo-exec-maven-plugin-1.1.1. exec
goal hangs the mvn build

Thanks for your prompt reply but I am afraid that unless I am missing 
something this won't do the trick.
My application uses an external relational database (HSQLDB but could 
also be MySQL).
So the integration testing requires my application to write information 
to a database instance and then retrieve the information and make some 
comparisons to make sure that everything played out nicely. To do that I

need an external database server up and running _before_ the integration

testing. In my example it is a database server but it could also have 
been another server my application needs to connect to (e.g. maybe a web

service provider server). So what I need is to _spawn_ an external 
process as part of the pre-integration test phase. Looking at 
sql-maven-plugin I cannot see how I can possible accomplish that.

Moreover this problem is part of a broader issue that hasn't got to do 
with databases in particular. What is the best way to setup in Maven 
your integration testing environment when your integration tests rely on

external servers. I may be ignorant since I am new to Maven but from 
what I see the codehaus exec plugin is used for that purpose. However, 
if it cannot be instructed to "spawn" the external process it hangs the 
whole life cycle.

Kuhtz, Andreas wrote:
> Maybe you should better use the sql-maven-plugin
> --> http://mojo.codehaus.org/sql-maven-plugin/examples/execute.html 
>
> -----Original Message-----
> From: Menelaos Perdikeas [mailto:[email protected]] 
> Sent: Mittwoch, 27. Januar 2010 14:04
> To: [email protected]
> Subject: [mojo-user] org.codehaus.mojo-exec-maven-plugin-1.1.1. exec
> goal hangs the mvn build
>
> Hi,
>
> I am using the org.codehaus.mojo exec plugin version 1.1.1. (the
"exec" 
> not the "java" goal) to spawn an external database to be used for 
> integration testing.
>
> My idea is to:
> 1. pre-integration-test phase: execute the codehaus exec plugin to
spawn
>
> an HSQLDB Server prior to integration testing
> 2. integration-test phase : do the integration tests (which utilize
the 
> database)
> 3. post-integration test phase: clean the database and shut it down
> nicely.
>
> Problem is I haven't got past step #1 as upon starting the database
the 
> mvn executable apparently "hangs" waiting for the database to exit.
> Here is my relevant POM section:
>
>         <plugin>
>             <groupId>org.codehaus.mojo</groupId>
>             <artifactId>exec-maven-plugin</artifactId>
>             <version>1.1.1</version>
>             <executions>
>                 <execution>
>                   <id>launching HSQDL DB for testing</id>
>                   <phase>pre-integration-test</phase>
>                   <goals>
>                     <goal>exec</goal>
>                   </goals>
>                   <configuration>
>                     <executable>java</executable>  
>                     <arguments>
>                         <argument>-classpath</argument>

>                
>                         <classpath/>
>                         <argument>org.hsqldb.Server</argument>
>                         <argument>-database.0</argument>
>                         
> <argument>file:target/data/tutorial</argument>                    
>                     </arguments>                     
>                   </configuration>
>                 </execution>
>               </executions>           
>         </plugin>
>
>   


-- 
Menelaos Perdikeas



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to