Run Vertx in an IDE

j will picture j will · Jun 18, 2014 · Viewed 19k times · Source

Is there any way to run Vertx from within an IDE? I know I can create a server in a file and then call

vertx run server.java

from the command line, but is there a way to run the server.java file from within an IDE?

Answer

sscarduzio picture sscarduzio · Jun 27, 2014
  • create a maven project as the manual says.

  • Then import the project as Maven project

  • Create a new launcher (Eclipse) using as main class

    • For Vert.x 2.x: "org.vertx.java.platform.impl.cli.Starter"
    • For Vert.x 3.x: "io.vertx.core.Starter"
  • In the tab "Program Arguments" type: "run your.package.ServerVerticle -conf conf.json"

You can omit the conf.json if you don't have one, it's just an example to show you that you can put there any other option you'd put launching Vert.x from the command line.

PRO TIP: if your verticle is written in another language, use the prefix with the name of the language as follows:

  • "run scala:com.acme.MainVerticle -conf conf.json"
  • "run jython:MainVerticle.py -conf conf.json"
  • "run jruby:MainVerticle.rb -conf conf.json"
  • "run rhino:MainVerticle.js -conf conf.json"
  • "run groovy:MainVerticle.groovy -conf conf.json"

And so forth.