[ 
http://jira.codehaus.org/browse/MJBOSS-8?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96452
 ] 

Mathias Arens commented on MJBOSS-8:
------------------------------------

Maybe here is a different solution for Windows XP. JBoss console output is 
displayed in a different console window, like in Tomcat. This has the advantage 
that the maven console can be used for different commands and it is not blocked 
because of the JBoss console output.

Here is my new launch() routine:

protected void launch(String fName, String params, boolean newConsole)
    throws MojoExecutionException {
        
        try {
            checkConfig();
            String osName = System.getProperty("os.name");
            Runtime runtime = Runtime.getRuntime();
            
            Process p = null;
            if (osName.startsWith("Windows")) {
                String[] command = null;
                if (newConsole) {
                    command = new String[] {
                    "cmd.exe",
                    "/c",
                    "start",
                    "/i",
                    "/d",
                    outputDirectory.getPath() + "\\bin",
                    "cmd.exe",
                    "/c",
                    fName + ".bat " + " " + params};
                } else {
                    command = new String[] {
                    "cmd.exe",
                    "/c",
                    outputDirectory.getPath() + "\\bin\\" +
                    fName + ".bat " + " " + params};
                }
                
                p = runtime.exec(command);
            } else {
                String command[] = {
                    "sh",
                    "-c",
                    "cd " + outputDirectory.getAbsolutePath() + "/bin; ./"
                            + fName + ".sh " + " " + params };
                p = runtime.exec(command);
            }
            
        } catch (Exception e) {
            throw new MojoExecutionException("Mojo error occurred: "
                    + e.getMessage(), e);
        }
    }

The calls of the launch() routine in the StartMojo and StopMojo class must be 
updated as well. I passed newConsole=true for the StartMojo and 
newConsole=false in the StopMojo class.

In contrast to the release versions 1.3.1 and 1.3.2 this solution works (as 
well as the contribution from Walmetz)

> JBoss:create does not starj jboss on Windows XP
> -----------------------------------------------
>
>                 Key: MJBOSS-8
>                 URL: http://jira.codehaus.org/browse/MJBOSS-8
>             Project: Maven 2.x JBoss Plugin
>          Issue Type: Bug
>    Affects Versions: 1.3.2
>         Environment: Windows XP Maven 2 JDK 1.5 + plugin 1.3.2-SNAPSHOT
>            Reporter: J-C Walmetz
>         Attachments: AbstractJBossMojo.java, ConsoleTextBlocking.txt
>
>
> I try to start JBoss with the mvn jboss:start command. Server does not start. 
> I have patched AbstractJBossMojo.java to make it run:
> protected void launch(String fName, String params)
>       throws MojoExecutionException {
>       ...
>       if (osName.startsWith("Windows")) {
>         String command[] = {
>             "cmd.exe",
>             "/C",
>             "cd " + outputDirectory.getAbsolutePath() + "\\bin & " + fName
>                 + ".bat " + " " + params };
>         p = runtime.exec(command);
>         dump(p.getInputStream());
>         dump(p.getErrorStream());
>       } else {
>       ...
> protected void dump(final InputStream a_input) {
>     new Thread(new Runnable() {
>       public void run() {
>         try {
>           byte[] b = new byte[1000];
>           while ((a_input.read(b)) != -1) {
>           }
>         } catch (IOException e) {
>           e.printStackTrace();
>         }
>       }
>     }).start();
>   }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

    http://xircles.codehaus.org/manage_email

Reply via email to