vertx web处体验+maven打包

pom.xml

1<?xml version="1.0" encoding="UTF-8"?> 2<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" 3 xmlns="http://maven.apache.org/POM/4.0.0" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 5 <modelVersion>4.0.0</modelVersion> 6 <groupId>net.loyin.study</groupId> 7 <artifactId>vertx</artifactId> 8 <version>1.0-SNAPSHOT</version> 9 <properties> 10 <vertx.version>3.8.1</vertx.version> 11 </properties> 12 <dependencyManagement> 13 <dependencies> 14 <dependency> 15 <groupId>io.vertx</groupId> 16 <artifactId>vertx-stack-depchain</artifactId> 17 <version>${vertx.version}</version> 18 <type>pom</type> 19 <scope>import</scope> 20 </dependency> 21 <dependency> 22 <groupId>io.vertx</groupId> 23 <artifactId>vertx-stack-depchain</artifactId> 24 <version>${vertx.version}</version> 25 <type>pom</type> 26 <scope>import</scope> 27 </dependency> 28 </dependencies> 29 </dependencyManagement> 30 <dependencies> 31 <dependency> 32 <groupId>io.vertx</groupId> 33 <artifactId>vertx-core</artifactId> 34 <version>${vertx.version}</version> 35 </dependency> 36 <dependency> 37 <groupId>io.vertx</groupId> 38 <artifactId>vertx-web</artifactId> 39 <version>${vertx.version}</version> 40 </dependency> 41 <dependency> 42 <groupId>io.vertx</groupId> 43 <artifactId>vertx-web</artifactId> 44 </dependency> 45 </dependencies> 46 <build> 47 <plugins> 48 <plugin> 49 <artifactId>maven-shade-plugin</artifactId> 50 <version>3.1.0</version> 51 <executions> 52 <execution> 53 <phase>package</phase> 54 <goals> 55 <goal>shade</goal> 56 </goals> 57 <configuration> 58 <transformers> 59 <transformer 60 implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 61 <manifestEntries> 62 <main-class>io.vertx.core.Starter</main-class> 63 <main-verticle>net.loyin.study.vertx.Application</main-verticle> 64 </manifestEntries> 65 </transformer> 66 </transformers> 67 <artifactSet/> 68 <!-- <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>--> 69 </configuration> 70 </execution> 71 </executions> 72 </plugin> 73 <plugin> 74 <artifactId>maven-compiler-plugin</artifactId> 75 <version>3.2</version> 76 <configuration> 77 <source>1.8</source> 78 <target>1.8</target> 79 <encoding>UTF-8</encoding> 80 </configuration> 81 </plugin> 82 </plugins> 83 </build> 84 <profiles> 85 <profile> 86 <id>jdk18</id> 87 <activation> 88 <activeByDefault>true</activeByDefault> 89 <jdk>1.8</jdk> 90 </activation> 91 <properties> 92 <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 93 <maven.compiler.source>1.8</maven.compiler.source> 94 <maven.compiler.target>1.8</maven.compiler.target> 95 </properties> 96 </profile> 97 </profiles> 98</project>

启动类:

1package net.loyin.study.vertx; 2 3import io.vertx.core.AbstractVerticle; 4import io.vertx.core.Vertx; 5import io.vertx.ext.web.Router; 6 7public class Application extends AbstractVerticle { 8 9 public static void main(String[] args){ 10 Vertx vertx=Vertx.vertx(); 11 vertx.deployVerticle(new Application()); 12 } 13 @Override 14 public void start(){ 15 Router router=Router.router(vertx); 16 router.route().handler(routingContext->{ 17 routingContext.response().putHeader("content-type", "text/html").end("Hello World!"); 18 }); 19 vertx.createHttpServer().requestHandler(router).listen(8800); 20 } 21}

Dockerfile

1FROM java:8 2VOLUME /tmp 3ADD ./target/vertx-1.0-SNAPSHOT.jar app.jar 4RUN bash -c 'touch /app.jar' 5EXPOSE 8800 6ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","app.jar"]
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

springboot2.1整合mybatis

1:添加依赖<?xmlversion"1.0"encoding"UTF8"?<projectxmlns"http://maven.apache.org/POM/4.0.0"xmlns:xsi"http://www.w3.org/2001/XMLSchemainstance"xsi

基于Maven工程下的MyBatis框架+MySQL+连接池的数据查询操作

具体操作项目结构引入项目依赖pom.xml<?xmlversion"1.0"encoding"UTF8"?<projectxmlns"http://maven.apache.org/POM/4.0.0"xmlns:xsi"http://www.w3.org/2001/XMLSchemainstance"xsi

java代码自动下载Spring Boot用户手册

本示例演示SpringBoot1.5.9.RELEASE版本的用户手册下载pom.xml<?xmlversion"1.0"encoding"UTF8"?<projectxmlns"http://maven.apache.org/POM/4.0.0"xmlns:xsi"http://w

Flink+Kafka整合的实例

FlinkKafka整合实例1.使用工具IntelligIDEA新建一个maven项目,为项目命名为kafka01。2.我的pom.xml文件配置如下。<?xmlversion"1.0"encoding"UTF8"?<projectxmlns"http://maven.apache.org/POM/4