1. <!--springweb依赖-->
    2. <dependency>
    3. <groupId>org.springframework.boot</groupId>
    4. <artifactId>spring-boot-starter-web</artifactId>
    5. </dependency>
    6. <!--单元测试依赖-->
    7. <dependency>
    8. <groupId>org.springframework.boot</groupId>
    9. <artifactId>spring-boot-starter-test</artifactId>
    10. <scope>test</scope>
    11. </dependency>
    12. <!--mybatis-spring依赖-->
    13. <dependency>
    14. <groupId>org.mybatis.spring.boot</groupId>
    15. <artifactId>mybatis-spring-boot-starter</artifactId>
    16. <version>2.1.4</version>
    17. </dependency>
    18. <!--mysql依赖-->
    19. <dependency>
    20. <groupId>mysql</groupId>
    21. <artifactId>mysql-connector-java</artifactId>
    22. <version>8.0.11</version>
    23. </dependency>
    24. <!--lombok依赖-->
    25. <dependency>
    26. <groupId>org.projectlombok</groupId>
    27. <artifactId>lombok</artifactId>
    28. <version>1.18.12</version>
    29. <scope>provided</scope>
    30. </dependency>
    31. <!--Druid数据库连接池依赖-->
    32. <dependency>
    33. <groupId>com.alibaba</groupId>
    34. <artifactId>druid-spring-boot-starter</artifactId>
    35. <version>1.2.8</version>
    36. </dependency>
    37. <!--PageHelper依赖-->
    38. <dependency>
    39. <groupId>com.github.pagehelper</groupId>
    40. <artifactId>pagehelper-spring-boot-starter</artifactId>
    41. <version>1.3.0</version>
    42. </dependency>
    43. <!--thymeleaf依赖-->
    44. <dependency>
    45. <groupId>org.springframework.boot</groupId>
    46. <artifactId>spring-boot-starter-thymeleaf</artifactId>
    47. </dependency>
    48. <!--thymeleaf实现权限显示的启动器-->
    49. <dependency>
    50. <groupId>org.thymeleaf.extras</groupId>
    51. <artifactId>thymeleaf-extras-springsecurity5</artifactId>
    52. <version>3.0.4.RELEASE</version>
    53. </dependency>
    54. <dependency>
    55. <groupId>org.springframework.boot</groupId>
    56. <artifactId>spring-boot-starter-thymeleaf</artifactId>
    57. </dependency>
    58. <!--自动编译依赖-->
    59. <dependency>
    60. <groupId>org.springframework.boot</groupId>
    61. <artifactId>spring-boot-devtools</artifactId>
    62. <optional>true</optional>
    63. </dependency>
    64. <!--SpringSecurity启动器-->
    65. <dependency>
    66. <groupId>org.springframework.boot</groupId>
    67. <artifactId>spring-boot-starter-security</artifactId>
    68. </dependency>
    69. <!--Maven中push到docker中-->
    70. <plugin>
    71. <groupId>com.spotify</groupId>
    72. <artifactId>docker-maven-plugin</artifactId>
    73. <version>1.2.2</version>
    74. <configuration>
    75. <imageName>hotel:1.0</imageName> <!--指定镜像名称 仓库/镜像名:标签-->
    76. <baseImage>openjdk:11</baseImage> <!--指定基础镜像-->
    77. <dockerHost>http://192.168.8.131:2375</dockerHost> <!-- 指定服务器仓库地址 -->
    78. <entryPoint>["java","-jar","/${project.build.finalName}.jar"]</entryPoint> <!-- 容器启动执行的命令 -->
    79. <resources>
    80. <resource>
    81. <targetPath>/</targetPath> <!-- 指定要复制的目录路径,这里是当前目录 -->
    82. <directory>${project.build.directory}</directory> <!-- 指定要复制的根目录,这里是target目录 -->
    83. <include>${project.build.finalName}.jar</include> <!-- 指定需要拷贝的文件,这里指最后生成的jar包 -->
    84. </resource>
    85. </resources>
    86. </configuration>
    87. </plugin>

    启动打包好的jar项目
    image.png