1 Reply Latest reply on Oct 27, 2009 7:31 PM by Dan Allen

    Weld on Jetty...why war:inplace?...causing "error"

    Steven Boscarine Apprentice

      Hello All,

      Why is war:inplace needed to run Weld on Jetty?  I've never seen that requirement before. 

      Also, I think it's causing errors as it doesn't appear to be cleaning the *.class files correctly. 

      Are there workarounds?

      Here's what I'm finding:

      Take a bean named HelloWorld:

      package org.bogus;
      import java.io.Serializable;
      import javax.enterprise.context.RequestScoped;
      import javax.inject.Named;
      public class HelloWorld implements Serializable {
           private final String text = "Hello World";
           public String getText() {
                return text;
           private static final long serialVersionUID = 1L;

      ...with a Jetty config of:

      <!-- Embedded Jetty (jetty:run) -->
                <!-- force friendly name instead of artifact name + version -->
                <!-- declare datasource -->
                <!-- This parameter will auto-deploy modified classes -->

      Change text to Hola Mundo and the container reloads, but the text is still Hello World.  Shut down the container and execute:

      mvn clean war:inplace jetty:run

      and the text is still Hello World.  Add the install command and the code change is picked up. 

      mvn clean install war:inplace jetty:run

      Under normal circumstances, that Jetty config would allow you to edit your class in eclipse, and the changes would be automatically propagated on save (when you declare scanIntervalSeconds, it scans the target dir).  Simply typing hola mundo and waiting about 10s would guarantee that you'd see Hola Mundo in the browser.  If you don't declare scanIntervalSeconds, shutting down the container and typing mvn clean jetty:run would rebuild the app as it's supposed to. 

      Is there a way for me to get weld to run without the war:inplace so Jetty would behave normally?  

      A pom config change for the Jetty plugin? 

      A weld lib change?

      A special command line flag?  anything?

      If not, are there mvn alternatives to Jetty?  I'd like to be able to save a change in a class file and see the results without any more effort on my part.  I don't think the tomcat or glassfish plugins scan the target directory for class changes. 

      How do the rest of you normally develop weld applications? 

      I like Jetty, but wouldn't mind using any other tools that are as reliable and allow for the same productivity. 

      Any help is greatly appreciated. 

        • 1. Re: Weld on Jetty...why war:inplace?...causing "error"
          Dan Allen Master

          I'm working on the weld reference guide right now while also reviewing the examples. I know that I put the war:inplace goal in there as an optimization to reduce the amount of build Maven had to do, but I don't remember the exact details. I do recall it was also a workaround for a bug in Mojarra (JSF 2) at the time.

          I'm going to verify why I did things the way I did them, and simplify if possible. Expected updates in Weld CR2.