2014-11-22 45 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/