未经授权不得转载
开发工具以及环境:
- IntelliJ IDEA 2018.2.4
- JDK 1.8
- Maven 3.5.4
- vert.x 3.4.2
首先创建一个空的Maven Project,pom.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lgc</groupId>
<artifactId>vertxproject</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- Launcher 为官方推荐启动器,MainVerticle 为启动入口 -->
<properties>
<vertx.version>3.4.2</vertx.version>
<main.class>io.vertx.core.Launcher</main.class>
<main.verticle>io.example.MainVerticle</main.verticle>
</properties>
<!-- 核心模块 -->
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<version>${vertx.version}</version>
<sco