怎么用vertxweb和maven打包文件

这篇文章主要介绍“怎么用vertx web和maven打包文件”,在日常操作中,相信很多人在怎么用vertx web和maven打包文件问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么用vertx web和maven打包文件”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

成都创新互联公司于2013年开始,先为白城等服务建站,白城等地企业,进行企业商务咨询服务。为白城企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

pom.xml



    4.0.0
    net.loyin.study
    vertx
    1.0-SNAPSHOT
    
        3.8.1
    
    
        
            
                io.vertx
                vertx-stack-depchain
                ${vertx.version}
                pom
                import
            
            
                io.vertx
                vertx-stack-depchain
                ${vertx.version}
                pom
                import
            
        
    
    
        
            io.vertx
            vertx-core
            ${vertx.version}
        
        
            io.vertx
            vertx-web
            ${vertx.version}
        
        
            io.vertx
            vertx-web
        
    
    
        
            
                maven-shade-plugin
                3.1.0
                
                    
                        package
                        
                            shade
                        
                        
                            
                                
                                    
                                        io.vertx.core.Starter
                                        net.loyin.study.vertx.Application
                                    
                                
                            
                            
                            
                        
                    
                
            
            
                maven-compiler-plugin
                3.2
                
                    1.8
                    1.8
                    UTF-8
                
            
        
    
    
        
            jdk18
            
                true
                1.8
            
            
                1.8
                1.8
                1.8
            
        
    

启动类:

package net.loyin.study.vertx;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;

public class Application extends AbstractVerticle {

    public static void main(String[] args){
        Vertx vertx=Vertx.vertx();
        vertx.deployVerticle(new Application());
    }
    @Override
    public void start(){
        Router router=Router.router(vertx);
        router.route().handler(routingContext->{
            routingContext.response().putHeader("content-type", "text/html").end("Hello World!");
        });
        vertx.createHttpServer().requestHandler(router).listen(8800);
    }
}

Dockerfile

FROM java:8
VOLUME /tmp
ADD ./target/vertx-1.0-SNAPSHOT.jar app.jar
RUN bash -c 'touch /app.jar'
EXPOSE 8800
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","app.jar"]

到此,关于“怎么用vertx web和maven打包文件”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!


网站栏目:怎么用vertxweb和maven打包文件
链接分享:http://pwwzsj.com/article/jdpeep.html