在 IDE 中运行 Vertx

人气:369 发布:2022-10-16 标签: eclipse ide intellij-idea netbeans vert.x

问题描述

有没有办法在 IDE 中运行 Vertx?我知道我可以在文件中创建一个服务器,然后调用

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

从命令行,但有没有办法从 IDE 中运行 server.java 文件?

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

推荐答案

按照手册的说明创建一个 Maven 项目.

create a maven project as the manual says.

然后将项目导入为Maven项目

Then import the project as Maven project

使用主类创建一个新的启动器 (Eclipse)

Create a new launcher (Eclipse) using as main class

对于 Vert.x 2.x:org.vertx.java.platform.impl.cli.Starter"对于 Vert.x 3.x:io.vertx.core.Starter"

在程序参数"选项卡中输入:运行 your.package.ServerVerticle -conf conf.json"

In the tab "Program Arguments" type: "run your.package.ServerVerticle -conf conf.json"

如果没有 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.

专业提示:如果您的 Verticle 是用另一种语言编写的,请使用带有语言名称的前缀,如下所示:

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

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

等等.

484