这里需要用到vertx-web依赖了,依然是在pom.xml里面导入
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.javafm
vertx.helloworld
1.0-SNAPSHOT
io.vertx
vertx-web
3.3.3
org.apache.maven.plugins
maven-compiler-plugin
3.6.0
1.8
1.8
这里只需要导入vertx-web就可以了,不需要vertx-core了,因为web依赖了core,会自动导入。而build标签里的maven-compiler-plugin是为了防止每次Import Changes的时候将jdk compiler还原到1.5而设置的。 如果不嫌麻烦,可以手动去设置jdk的编译级别,这个maven-compiler-plugin就可以不用配置了。
编写HelloRouter.java代码
package com.javafm.vertx.helloworld;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
/**
* Created by le