maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerome Lacoste" <jerome.laco...@gmail.com>
Subject Re: Starting a new java process from within a test case is hanging the maven JVM
Date Fri, 20 Apr 2007 07:58:06 GMT
On 4/20/07, Balasubramanian, Ravi Shankar <rbalasub@informatica.com> wrote:
> Hi,
> Following is my test class that starts a notepad process from within:
> " public void startProcessNotepad() throws IOException {
>                 Process p = Runtime.getRuntime().exec("notepad");
>                 System.out.println("....NOTEPAD STARTED....");
>         }
> "
>
> When I execute this test through maven using "mvn test" through the
> surefire plugin, maven does not exit until the notepad process is
> closed/terminated.
> I have attached the thread dump long along with this mail. Please look
> into it and let me know if there is a way to work around this. I will
> want to be starting a server process in one of my test cases and wants
> maven to continue with other builds for whose test cases, the server
> needs to be running.

maven forks the test execution. This forked execution doesn't
terminate so maven doesn't terminate.

As to why the forked execution doesn't terminate, it's because you
didn't spaw a new process independent of the original one.

To achieve this you will have to use a cmd and special options. You
will also have to be careful at what your executed process does with
stdin/stdout/stderr

I suggest you to read this:
http://forums.java.net/jive/thread.jspa?threadID=24837

Jerome

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message