Wednesday, May 16, 2012

Debugging Vert.x apps with Eclipse


+Pascal Rapicault has me hooked on Vert.x, http://vertx.io. It looks like it can be a great competitor to node.js allowing you to use the same asynchronous web programming model not only with JavaScript by any of your favorite JVM languages, including Java believe it or not!

At any rate, tonight I started to see if I can use Eclipse to develop apps in Vert.x. It turned out to be a lot trickier than I thought so I figured I'd capture what I did here.

First, you need to create a User Library for Vert.x. I just looked at the bin/vertx script to see what it added to the Java classpath to see what jars to add to the library. After that I was able to create a Java project and add the library to the build path and code up my little hello world app (which indeed is very node.js like).


Launching is pretty tricky. First, Vert.x doesn't want your app to be on the classpath when it starts up. Weird and that means you have to remove your project from the Classpath. But you do then need to add in your Vert.x user library using the advanced option so it can launch Vert.x's main, which is VertxMgr.




And you need to add your project build output with the -cp application option, which I passed ${project_loc:/vertxHelloWorld}/bin, so it can find your Verticle class.



Finally when you debug, the Default source path matches your Classpath. Since you removed your project from the Classpath, you have to add your project to the sources manually in the Source tab.


I imagine someday, someone will create a Launch Configuration that will do this all for you but if you put some muscle in it, you can get up and debugging your Vert.x app in Eclipse now. Now, if I can debug my client-side JavaScript in the same session...

12 comments:

  1. There you go, now I can debug in eclipse!!!
    (I think vert.x does not like your applicaction in the classpath just to avoid isolation issues)

    Very useful post!

    ReplyDelete
  2. Thanks for your post! It really helped me.

    With that, I've just backed a first version of sample Maven 2 project that includes Eclipse launchers:

    https://github.com/crazyfrozenpenguin/cpenguin_repository/tree/master/vert-x

    ReplyDelete
  3. Thanks a lot for this!

    ReplyDelete
  4. Hello All,

    Nice post :)

    Just to let you know - the entire developer experience is being hugely simplified in Vert.x 2.0. This means out of the box Maven and Gradle template projects, seamless debugging in IDEs without _any_ special setup. Seamless testing in IDEs without _any_ special setup.

    This is currently working in the current master (which is the dev branch for Vert.x 2.0) if you're brave enough to try it.

    Hopefully Vert.x 2.0 will be out in the next month or so! :)

    ReplyDelete
  5. Nice, and hopefully the fact that we hope vert.x will be joining the Eclipse family will inspire folks to do a lot more around providing assistance for where it may be required (Tim's comments notwithstanding!). Here's to more vert.x fun at EclipseCon next week!

    ReplyDelete
  6. You can use strategies & signals and work with
    binary option tradingbut i can tell you that before you can use any strategy you have to understand yourself first, how is your mind work, without it you will continue the up and down profit/loss, feeling pressure/calm.I also
    worte an Entire post about the winners about this site.
    Click hear http://www.automatedbinaryoptions.co/?p=178

    ReplyDelete
  7. Better start with forex and after that nadex binary options learn and only then trade binary options, but i can tell you that before you can use any strategy you have to understand yourself first, how is your mind work, without it you will continue the up and down profit/loss, feeling pressure/calm.More information please visit our web Our web site is http://www.automatedbinaryoptions.co/?p=180

    ReplyDelete
  8. This is such an informative article and very clearly written. Every single thought and idea is direct to the point. Perfectly laid out. Thank you for taking your time sharing this to you readers.
    woodworking plans

    ReplyDelete
  9. Thank you!
    After using your method, for a first start, I got the inspiration for a more-simple method:
    Just put a main into your project and call the Vert.x Starter from it.
    E. G.
    public static void main(String[] args)
    {
    org.vertx.java.platform.impl.cli.Starter.main(new String[]{"run",YourVertx.class.getName(), "-cp", new File("bin").getAbsolutePath()});
    }

    And it's the same thing, with the difference you can easily change Vert.x node and don't have to manually configure the runner.
    Hope this can hel someone.

    ReplyDelete
  10. Thanks for your post.

    ReplyDelete
  11. Anonymous9:42 a.m. GMT

    Thanks .Give me great information .I have one serves .If you need help contact Emergency Exchange Support with me .

    ReplyDelete