springboot系列4-简化部署

1.导入生成可执行jar包的依赖

打开pom.xml文件,添加:

<!-- Package as an executable jar -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

2.打包

在这里插入图片描述

输出以下内容表示构建成功:

[INFO] Building jar: D:\work\workspace\springboot\spring-boot-01-helloworld\target\spring-boot-01-helloworld-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.0.6.RELEASE:repackage (default) @ spring-boot-01-helloworld ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.642 s
[INFO] Finished at: 2018-10-24T21:54:07+08:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

将目录下的D:\work\workspace\springboot\spring-boot-01-helloworld\target\spring-boot-01-helloworld-1.0-SNAPSHOT.jar 拷贝到测试目录,运行jar包:

	java -jar .\spring-boot-01-helloworld-1.0-SNAPSHOT.jar

浏览器中运行localhost:8080/hello测试,输出Hello world!

至此,部署成功~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值