January 4th, 2010 by Lincoln Baxter III

Java Web-App Development: What’s your Secret?

OcpSoft is considering a new development environment for our projects, and we need your help. Our current development environment is annoying, painful at times. So the question is: “What development environment would you recommend?”

What about your way of doing things makes your life easy? What do you still wish you could fix?

Requirements:

The tools must support:
  • Running a server and making runtime changes to Java class-files in the workspace – If a class or class in a referenced project is changed, those changes should also propagate to the running server so that changes may be seen in real-time.
  • Maven dependencies – Yeah, we use Maven, do you?
  • Visual/step debugging – A necessary evil at some points, but not 100% required.

What we’ve got so far:

The closest we’ve come to this is with Eclipse, M2Eclipse, Tomcat, and JavaRebel, but M2Eclipse has trouble resolving workspace dependencies, and changes made to some upstream projects inevitably force rebuilding and restarting the server. This is becoming a big problem for us; everything used to work fine before we switched to Maven…

What’s your secret?

Please share. We need your help.
Lincoln Baxter, III

About the author:

Lincoln Baxter, III is the Chief Editor of Red Hat Developers, and has worked extensively on JBoss open-source projects; most notably as creator & project lead of JBoss Forge, author of Errai UI, and Project Lead of JBoss Windup. This content represents his personal opinions, not those of his employer.

He is a founder of OCPsoft, the author of PrettyFaces and Rewrite, the leading URL-rewriting extensions for Servlet, Java EE, and Java web frameworks; he is also the author of PrettyTime, social-style date and timestamp formatting for Java. When he is not swimming, running, or playing competitive Magic: The Gathering, Lincoln is focused on promoting open-source software and making technology more accessible for everyone.

Posted in OpenSource

10 Comments

  1. Josh Long says:

    I used to use m2eclipse, and Tomcat 6 in debug mode, with no JavaRebel. This worked fine *IF* I could get Eclipse to treat a project nicely – ie, Spring MVC projects never felt right and editing JSPX files was painful. JSF + anything worked (but was slow) if you use the JBoss IDE plugin (whether Spring Faces, raw JSF, or Seam). Upshot: it lets you make changes to methods on classes but not to the interface of classes (ie, if you add or remove a method then it necessitated a restart.) and debugging worked. Downside: Eclipse quirkiness and the need to dance around with a bazillion plugins (Subclipse, m2Eclipse, Spring / JBoss plugins) just to get a basic project working (at what speed was a different issue!)

    Now, with the recently released IntelliJ IDEA 9 Ultimate, I’m not sure I could ever justify going back to Eclipse. If you have a Maven war project you can configure a Tomcat Local run configuration and have it run in debug mode – just as with Eclipse. So, debugging/stepping works just fine and you can make changes to classes at runtime and hot deploy (ctrl + f10!) the changed classes as before. It works great! Also, Subversion/Git/whatever are all supported and you couldn’t ask for a quicker/slicker integration with Maven (in 8.0 it was burdensome and less powerful than in m2Eclipse, but with 9 a lot of the niceties are there and updates to the pom don’t freeze the world while indexing the repositor(y|ies). PLUS: Spring Web Flow/Spring Faces/JSF/Seam/Spring (just in general), Tapestry, JSP(X?) all have integrations out of the box that work nicely and don’t cause noticeable, extra thrashing when invoked. Upside: works perfectly (quick, low friction for checkout-and-setup, handles all the requires). Downside: it costs a little bit. YMMV. Try the demoe and ping me if I can help.

    I’ve been a longtime Maven Jetty plugin user whenever I use IntelliJ simply because I could never easily get an application hot deploying/debuggable from inside IntelliJ. That’s all changed, and it even knows how to use your Maven setup to do the exploded war setup using site:war…

    Good luck!

  2. You could probably embed the Jetty server as an in-process activity. That makes it as easy as right-click the Java file and click “Run as Java app”.

    Jettify may be useful — http://code.google.com/p/bitumenframework/

    Since you are using Maven, you could write an assembly descriptor to pull all dependency JARs, which makes it easy to develop in Eclipse (orany IDE).

    This approach makes is easy to debug/step through code also.

    However, if you are using EJB etc, then embedding an EJB container may be pain.

  3. Alan Vargas says:

    Why not use Glassfish v3 + NetBeand IDE. You have all in one! And support for all you want to do.

  4. Henry Ho says:

    Have you tried ColdFusion? 🙂

  5. Lincoln says:

    We haven’t been able to get Maven hot-deploy working with NetBeans, though it would be the final piece of the puzzle there. Has anyone gotten that working?

  6. Lincoln says:

    @Josh Long – So if you have a maven WAR project that has a dependency, say: ocpsoft-pretty-faces:2.0.4-SNAPSHOT, and that referenced project just happens to also be open in the workspace, it will resolve to the workspace project first, and not the maven repository?

    1. Goutham Rao says:

      i use netbeans + jrebel + glassfish and hotdeploy works like a charm . on your maven project have you unchecked the "deploy on save "check box ? ( ps: you will find that in project –> properties and somewhere in there )

      Regards,
      Goutham

  7. Lincoln says:

    Really it would be nice if m2eclipse resolved workspace artifacts properly. It “forgets” about some workspace artifacts and dependent projects cannot find them, hence, build path errors ensue.

  8. Lincoln says:

    So what we’ve decided to do for now is sort of a workaround, but:

    1. Eclipse
    2. maven-eclipse-plugin (mvn eclipse:eclipse to generate .project/.classpath/.settings files
    3. Import that project and configure any workspace-resolved non-module dependencies by hand.

    This approach requires some up-front setup, but once it’s done, is much more stable than any combination of plugins that we’ve used before.

    IntelliJ seems promising, and I’m going to give it a legitimate shot, but so far a few things are a little less than intuitive (not that eclipse doesn’t have those things as well.)

  9. Thorseth says:

    Have a look at Grails. Supported in most java IDE’s but IDEA has the best support at current.
    Its a mvc framework that supports runtime changes.
    Embeds many best practices.
    Based on DRY, Sensible Defaults, Spring (IOC, AOP). And it has a lot of various time-saving plugins, have a look at those too, when your at it. (Owned n’backed by SpringSource.)
    http://www.grails.org

Leave a Comment




Please note: In order to submit code or special characters, wrap it in

[code lang="xml"][/code]
(for your language) - or your tags will be eaten.

Please note: Comment moderation is enabled and may delay your comment from appearing. There is no need to resubmit your comment.