如何在eclipse上运行Vert.x Verticle?

问题描述 投票:1回答:3

你能列出一些关于如何从eclipse运行Vertical或将我引导到源的步骤吗?我无法在任何地方找到明确的步骤。

eclipse vert.x
3个回答
1
投票

使用maven原型创建和构建项目,如下所述:http://vertx.io/maven_dev.html#generate-the-project

例如,使用以下maven命令:mvn archetype:generate -Dfilter = io.vertx:-DgroupId = com.mycompany -DartifactId = my-module -Dversion = 0.1

  1. 将maven项目导入Eclipse
  2. 创建Java Application类型的运行配置
  3. 在Main选项卡中输入Main Class: org.vertx.java.platform.impl.cli.Starter
  4. 在Arguments选项卡中输入Program arguments: runmod com.mycompany~my-module~0.1
  5. 点击运行。

参考:http://www.smartjava.org/content/create-simpe-restful-service-vertx-20-rxjava-and-mongodb


1
投票

从Eclipse运行Verticle有/无外部配置文件。

我使用垂直方式部署了HttpServer,但为了简单起见,我采用了一个简单的垂直方式。如果您不想传递config,只需从下面给出的命令中删除-conf参数。

假设我有一个名为SimpleVerticle.java的类

我的项目结构是这样的。

enter image description here

我的垂直代码如下。

import io.vertx.core.AbstractVerticle;

public class SimpleVerticle extends AbstractVerticle{


    @Override
    public void start() {
        System.out.println("In Simple Verticle Start Method");

        System.out.println("the port configuration is : "+config().getInteger("http.port",8080));
    }
}

我的Config文件如下所示:

{
  "http.port" : 8082
}

现在你所要做的就是,第1步:右键单击Verticle文件,选择RunAs - > Run Configurations Step2:在主选项卡的Main Class字段中,输入qazxsw poi

步骤3:在Arguments选项卡的Program Arguments字段中,输入以下内容,

io.vertx.core.Launcher

run com.tutorial.venu.SimpleVerticle -conf src/main/conf/vertx-myapp-conf.json enter image description here

然后单击Run !!

Boom,您可以使用从配置文件中获取的配置项来部署Verticle。

enter image description here

请参阅视频链接:enter image description here


0
投票

最好的选择是Vert.x Google Group:

http://vertx.io/blog/automatic-redeployment-in-eclipse-ide/

在那里,您可以从Tim Fox和其他核心开发人员那里获得答案。

至于你的Eclipse问题,我假设你找到了这个页面:

https://groups.google.com/forum/#!forum/vertx

© www.soinside.com 2019 - 2024. All rights reserved.