1)选择File>>Project Structure... (Ctrl+Alt+Shift+S)
2)接着选择Artifacts>> + >>JAR>>From modules with dependencis...
3)
Module:你的项目
Main Class:你的项目启动类(即有main函数的类)
JAR files from libraries:选择copy to the output directory and link via mainifest
Director for META-INF/MANIFEST.MF:选择...\main\resources目录
点击OK。
4)Output directory:jar包生成在这个目录上(可修改)
点击OK
5)选择Build>>Build Artifacts...>>Build,完成jar包的生成。
6)运行jar包。window下使用cmd命令窗口进入jar包目录,然后执行java -jar xxx.jar,便完成运行。
结语:
遇到的问题:mysql时区问题。
解决方案:修改application.properties文件(即添加serverTimezone=GMT%2B8),如下:
spring.datasource.url=jdbc:mysql://localhost:3306/familyedu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8