[jira] Created: (JETTY-991) Starting Jetty in separate JVM

classic Classic list List threaded Threaded
36 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
Starting Jetty in separate JVM
------------------------------

                 Key: JETTY-991
                 URL: http://jira.codehaus.org/browse/JETTY-991
             Project: Jetty
          Issue Type: New Feature
          Components: Maven2
    Affects Versions: 6.1.16
            Reporter: Stevo Slavic


Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Assigned: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org

     [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Bartel reassigned JETTY-991:
--------------------------------

    Assignee: Jan Bartel

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=173593#action_173593 ]

Jan Bartel commented on JETTY-991:
----------------------------------

Hi Stevo,

I'm not familiar with the way the code-coverage plugins work. I thought most things worked in-process? At what point would the code whose coverage you want to measure get forked with a normal jar-based project?

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=173607#action_173607 ]

Stevo Slavic commented on JETTY-991:
------------------------------------

Hello Jan,

Cobertura at least, registers a shutdown hook, on which coverage data get stored to a file ( see http://cobertura.svn.sourceforge.net/viewvc/cobertura/trunk/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java?revision=464&view=markup ). Maven surefire can be configured to fork JVM never, once for all tests, or once for each test (never/once/always), and for simple unit tests this works ok - coverage data get updated at least after last unit test ends. But for functional (e.g. selenium based) tests of an web application, if that web application (with cobertura instrumented code) is deployed using jetty, it runs in same JVM as Maven build. Thus currently, only when build stops (due to either failure or success) does shutdown hook get triggered, and coverage data get written to a file. This is too late for maven coverage report to get generated as part of the build process. On Cobertura FAQ ( http://cobertura.sourceforge.net/faq.html ), at the end of the list there is a Q devoted to this.

This is only one use case where it would be useful to support such a feature in jetty maven plugin. If this is major change, maybe it would be wise to leave the issue open and let users vote and/or add more use cases.

Feature itself maybe can be supported through a simple configuration parameter of run/runExpaneded/runWar mojos, like forkMode for maven surefire plugin, with default being "never" for behavior to remain the same for current maven jetty plugin users, but with option to change the setting so that jetty runs in separate jvm instance.

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=173609#action_173609 ]

Jan Bartel commented on JETTY-991:
----------------------------------

Thanks for the info Stevo. Just wondering - does running the plugin in the way described on the wiki page under the heading "Automatic execution of the plugin" work for you? In that mode, jetty is started before the tests execute, then explicitly stopped after the tests have finished, but in such a way that it does not stop the whole jvm, it merely just stops the jetty server, so the cobertura plugin should be able to do its stuff on the shutdown hook.

Does that make sense?

Jan

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=173614#action_173614 ]

Stevo Slavic commented on JETTY-991:
------------------------------------

This is exactly what I'm doing (see [1] ). As you can see from the pom snippet, I'm using recently introduced deploy-war mojo/goal to start jetty and deploy prebuilt application war. Jetty stop doesn't (and shouldn't) stop Maven build JVM, only the server and thus the application. So, as [2] shows, coverage data gets saved only when Maven build stops. What I could do, as a workaround, is to register a listener on application stop to programmatically  force cobertura to flush coverage data - but this is not nice as application itself will get dirty with test related code. What I'd prefer is for jetty maven plugin to support via a configuration option to have jetty started in separate JVM from the JVM where Maven build is running, expecting that in that scenario jetty stop will also stop the JVM jetty was running in (still not the one Maven build is running in) and thus trigger shutdown hook for cobertura, allowing coverage report to be generated.

Btw, with recent 6.1.16 release, I had to manually add jetty-util dependency, this was not needed in previous 6.1.15 release. But that's a different issue.


[1] Maven pom.xml snippet

...
<plugin>
        <groupId>org.mortbay.jetty</groupId>
        <!--
        <artifactId>jetty-maven-plugin</artifactId>
        <version>7.0.0.pre6</version>
        -->
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.16</version>
        <configuration>
                <scanIntervalSeconds>5</scanIntervalSeconds>
                <stopPort>9966</stopPort>
                <stopKey>foo</stopKey>
                <connectors>
                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                <port>8080</port>
                                <maxIdleTime>60000</maxIdleTime>
                        </connector>
                        <!--
                        <connector implementation="org.mortbay.jetty.ssl.SslSelectChannelConnector">
                        -->
                        <connector implementation="org.mortbay.jetty.security.SslSocketConnector">
                                <port>8443</port>
                                <maxIdleTime>60000</maxIdleTime>
                                <keystore>${basedir}/src/test/jetty/server.keystore</keystore>
                                <keyPassword>123456</keyPassword>
                        </connector>
                </connectors>
                <webApp>${project.build.directory}/${project.build.finalName}-instrumented.war</webApp>
                <webAppConfig>
                        <contextPath>/${project.build.finalName}-instrumented</contextPath>
                </webAppConfig>
                <systemProperties>
                        <systemProperty>
                                <name>org.apache.commons.logging.Log</name>
                                <value>org.apache.commons.logging.impl.SimpleLog</value>
                        </systemProperty>
                </systemProperties>
        </configuration>
        <dependencies>
                <!--
                <dependency>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-ssl</artifactId>
                        <version>7.0.0.pre6</version>
                </dependency>
                -->
                <dependency>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-util</artifactId>
                        <version>6.1.16</version>
                </dependency>
        </dependencies>
        <executions>
                <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                                <goal>deploy-war</goal>
                        </goals>
                        <configuration>
                                <daemon>true</daemon>
                        </configuration>
                </execution>
                <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                                <goal>stop</goal>
                        </goals>
                </execution>
        </executions>
</plugin>
...


[2] Successful Maven build log snippet with cobertura saving coverage data

...
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 minutes 11 seconds
[INFO] Finished at: Wed Apr 15 16:08:29 CEST 2009
[INFO] Final Memory: 115M/1016M
[INFO] ------------------------------------------------------------------------
2009-04-15 16:08:30.481::INFO:  Shutdown hook executing
2009-04-15 16:08:30.481::INFO:  Shutdown hook complete
Cobertura: Loaded information on 175 classes.
Cobertura: Saved information on 175 classes.

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235780#action_235780 ]

Rafael Mahnovetsky commented on JETTY-991:
------------------------------------------

+1 I need this for code coverage as well..

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241058#action_241058 ]

E Kawas commented on JETTY-991:
-------------------------------

+1 I need this too! I embedded jetty in another application and stopping jetty exits my application.

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ http://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241909#action_241909 ]

Jan Bartel commented on JETTY-991:
----------------------------------

To all those watchers of this issue:

Will it meet your needs if the "stop" goal was able to do a System.exit() instead of just stopping jetty?

thanks
Jan

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: http://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
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 | Threaded
Open this post in threaded view
|

[jira] Assigned: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

     [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Gorovoy reassigned JETTY-991:
-------------------------------------

    Assignee: Michael Gorovoy  (was: Jan Bartel)

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Michael Gorovoy
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Resolved: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

     [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Gorovoy resolved JETTY-991.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 7.5.0

I've implemented a new run-forked mojo that is similar to run-war mojo except that it runs Jetty in a different JVM. Below is a snippet of the plugin configuration that shows how it could be used.

{noformat}
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>7.5.0-SNAPSHOT</version>
        <executions>
          <execution>
            <id>start-webapp</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>run-forked</goal>
            </goals>
          </execution>
          <execution>
            <id>stop-webapp</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <daemon>true</daemon>
          <stopPort>8181</stopPort>
          <stopKey>stopme</stopKey>
        </configuration>
      </plugin>
{noformat}

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Michael Gorovoy
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Reopened: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

     [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Bartel reopened JETTY-991:
------------------------------

      Assignee: Jan Bartel  (was: Michael Gorovoy)

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=279136#comment-279136 ]

Jan Bartel commented on JETTY-991:
----------------------------------

As we need to reimplement this forking mojo to remove the dependency on the jetty-runner jar, I've taken the opportunity to revisit it.

What I've implemented is the ability to fork off a new process to run jetty on the *unassembled* webapp. So, its very similar to the jetty:run mojo, but just in a new jvm.

However, the configuration is somewhat different. For example, you cannot use the <webAppConfig> element to configure the WebAppContext representing the webapp, nor the <connectors>, <loginServices> and <requestLog> to configure the jetty Server. Instead, you use context xml and jetty xml files instead (actually, I've been intending for some time to entirely remove the <connectors>, <loginServices> and <requestLog> elements, as using jettyxml files is a much better way to do it). Here's an example of config suitable for the run-forked goal:

{code:xml}
<configure>
  <!-- where the unassembled web.xml is (optional: default value shown) -->
  <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>

  <!-- where the root of the unassembled webapp is (optional: default value shown) -->
  <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory>

  <!-- where the tmp directory for the webapp is (optional: default value shown) -->
  <tmpDirectory>${project.build.directory}/tmp</tmpDirectory>

  <!-- where the classes for the webapp are (optional: default value shown) -->
  <classesDirectory>${project.build.outputDirectory}</classesDirectory>

  <!-- where the test classes for the webapp are (optional: default value shown) -->
  <testClassesDirectory>${project.build.testOutputDirectory}</testClassesDirectory>

  <!-- whether or not to put the test classes on the webapp's classpath (default shown) -->
  <useTestClasspath>false</useTestClasspath>

  <!-- context xml file to configure the WebAppContext (optional) -->
  <contextXml>src/main/config/context.xml</contextXml>

  <!-- the path for the deployed webapp (mandatory) -->
  <contextPath>/foo</contextPath>

  <!-- comma sep list of jetty xml files to configure the Server (optional) -->
  <jettyXml>src/main/config/jetty1.xml,src/main/config/jetty2.xml</jettyXml>

  <!-- stop port -->
  <stopPort></stopPort>

  <!-- stop key -->
  <stopKey></stopKey>

  <!-- skip the execution or not (default shown) -->
  <skip>false</skip>
</configure>
{code}

When run with "mvn jetty:run-forked" the above would start up a separate jvm, and start a Server which is configured by the src/main/config/jetty1.xml and src/main/config/jetty2.xml files, and then deploy a WebAppContext to it representing the unassembled webapp that is configured by a combination of the src/main/config/context.xml file, the pom, and generated by the plugin.

Now, my questions for those interested in this type of plugin are:

* what is the lifecycle relationship you want between the plugin and the forked process?
** should the plugin wait for the child process to finish?
or
** should the plugin finish immediately after forking, leaving the child process running? (Won't this leave orphaned processes running?)

If some of you could provide example webapps and poms of how you'd like to run these forked executions that I could test with, that would be very helpful.

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=279137#comment-279137 ]

Jan Bartel commented on JETTY-991:
----------------------------------

I should point out that the work is being done in a branch called "forked-runner" in the codehaus git repo at [hidden email]/jetty-project.git

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=279862#comment-279862 ]

Caoilte O'Connor commented on JETTY-991:
----------------------------------------

Thanks Jan,
I just lifted parts of that code for launching a jetty instance in a separate process. It would be very cool if this was easier to do using the standard Jetty starter classes.

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=279878#comment-279878 ]

Jan Bartel commented on JETTY-991:
----------------------------------

The "forked-runner" branch has been merged into head with commit a043b51.

I still need feedback on how users want the lifecycle of the plugin to relate to the lifecycle of the forked jetty. Currently, whenever one stops so does the other one. Maybe this is not what is required???

thanks
Jan

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven2
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=284832#comment-284832 ]

Louis Burton commented on JETTY-991:
------------------------------------

Thanks for implementing this feature.
Is there any hope of a similar forked option for other goals? In particular, the 'deploy-war' goal. I would like to measure coverage of a war, but my war is pre-assembled.

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] Commented: (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=284979#comment-284979 ]

Larry Shatzer commented on JETTY-991:
-------------------------------------

I'm running Jetty during my integration test phase, and I need the forked jetty to return control back to maven like a regular jetty:run would in a maven lifecycle. I'm using similar configuration as explained in http://maven.apache.org/plugins/maven-failsafe-plugin/usage.html where it binds to the pre-integration-test phase and the post-integration-test phase. It works with just run, now I would like it to work with run-forked, so I can add some extra items to the jvmArgs (such as a javaagent for Jacoco to get code coverage of the Jetty instance)

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
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 | Threaded
Open this post in threaded view
|

[jira] (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=288860#comment-288860 ]

Sascha Theves commented on JETTY-991:
-------------------------------------

We have exactly the same use case as Larry Shatzer. The run-forked goal must return when the jetty was started so we can run our integration tests against it. We only need that to specify another javaagent (jacoco) via the jvmArgs parameter.
               

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.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 | Threaded
Open this post in threaded view
|

[jira] (JETTY-991) Starting Jetty in separate JVM

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org

    [ https://jira.codehaus.org/browse/JETTY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=292624#comment-292624 ]

Andreas Hochsteger commented on JETTY-991:
------------------------------------------

We have exactly the same use case too as Larry and Sascha!

The combination of maven-failsafe-plugin, maven-jetty-plugin and Sonar/Jacoco seems such a natural fit for integration test coverage that it's a pitty that this use case does not work.

Does somebody know a usable workaround (e.g. manually starting jetty w/o the maven plugin or offline bytecode instrumentation using something else than Jacoco)?

Thanks,

Andreas

               

> Starting Jetty in separate JVM
> ------------------------------
>
>                 Key: JETTY-991
>                 URL: https://jira.codehaus.org/browse/JETTY-991
>             Project: Jetty
>          Issue Type: New Feature
>          Components: Maven
>    Affects Versions: 6.1.16
>            Reporter: Stevo Slavic
>            Assignee: Jan Bartel
>             Fix For: 7.5.0
>
>
> Please support starting jetty (using jetty-maven-plugin) in separate JVM istance than one Maven build is running in. With jetty-maven-plugin running in separate JVM instance, stopping it should exit JVM instance Jetty was running in. This would enable maven code coverage plugins like maven cobertura plugin to get coverage data on time for maven report generation, as these data get stored on JVM exit event.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.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


12