Spring Boot学习——将应用打包为jar运行

将上述应用打包为jar,在命令框执行(windows)

  1. 在pom.xml中引入第三方插件

     <!--利用插件,将此应用打成jar包-->
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    
  2. 使用maven的package打为jar。
    点击maven的package双击
    在这里插入图片描述

  3. 将jar包拷贝出来(在idea的target包下)
    在这里插入图片描述

  4. 使用java -jar 文件名
    在这里插入图片描述

  5. 应用启动成功,在8080端口访问
    在这里插入图片描述

发布了159 篇原创文章 · 获赞 86 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/qq_40301026/article/details/103093706