1.在IDE中直接启动运行
新建MainLaucher类 extends Launcher , 运行main方法
package ;
import ;
public class MainLauncher extends Launcher {
public static void main(String[] args) {
new MainLauncher().dispatch(new String[] { "run", () });
}
}复制代码
使用maven命令启动运行, 在配置文件中,配置plugin插件,运行maven命令:mvn exec:java
<plugin>
<groupId></groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="">
<manifestEntries>
<Main-Class></Main-Class>
<Main-Verticle>${}</Main-Verticle>
</manifestEntries>
</transformer>
<transformer implementation="">
<resource>META-INF/services/</resource>
</transformer>
</transformers>
<artifactSet>
</artifactSet>
<outputFile>${}/${}-${}-</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId></groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<mainClass></mainClass>
<arguments>
<argument>run</argument>
<argument>${}</argument>
</arguments>
</configuration>
</plugin>复制代码
一般使用vertx-maven-starter,都已经在文件中配置
复制代码
-jar包启动运行
使用maven命令: mvn clean package, 打成fat-jar包,在target目录下会生成两个jar包
使用java 命令运行fat-jar包: java -jar vertx-start-project-1.