2014-11-22 43 views

回答

1

创建和使用Maven原型打造的项目如下解释:http://vertx.io/maven_dev.html#generate-the-project

例如,使用以下Maven命令:MVN原型:生成-Dfilter = io.vertx:-DgroupId = com.mycompany -DartifactId =我的模块-Dversion = 0.1

  1. 导入Maven项目到Eclipse

  2. 创建类型的Java应用程序

  3. 在主要选项卡中输入主类的运行配置:

            org.vertx.java.platform.impl。 cli.Starter

  4. 在参数选项卡中输入程序参数:

            runmod com.mycompany〜my-module〜0.1

  5. 点击运行。

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

0

从Eclipse运行同一个Verticle /不带外部配置文件。

我在HttpServer上使用Verticle进行了部署,但为了简单起见,我采用了一个简单的Verticle。如果你不想传递配置,只需从下面给出的命令中删除-conf参数。

可以说我有一个名为SimpleVerticle.java

我的项目结构是这样的类。

enter image description here

我verticle代码如下所示。

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)); 
    } 
} 

我的配置文件看起来像这样:

{ 
    "http.port" : 8082 
} 

现在,所有你需要做的就是, 第一步:右击verticle文件,选择运行方式 - >运行配置 第二步:在主标签, 在主类字段中输入io.vertx.core.Launcher

第三步:在参数选项卡,在程序参数字段中输入以下,

run com.tutorial.venu.SimpleVerticle -conf src/main/conf/vertx-myapp-conf.json 

enter image description here enter image description here

,然后单击运行!

繁荣,你得到你的Verticle部署配置项从配置文件中获取。

enter image description here

请参阅视频链接: http://vertx.io/blog/automatic-redeployment-in-eclipse-ide/