spring boot project.war文件在部署到webapps文件夹后不会自动启动

gdx19jrr  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(344)

我实现了一个spring-boot项目,将.ar作为 Package 。我将它部署到webapps文件夹中的服务器上。
我做了什么,spring-project.war在部署到webapps文件夹后会自动启动?
pom.xml中有任何maven技巧吗?
将它推送到git上的主分支之后,spring boot项目将使用mvn clean package-p war自动打包,然后.war文件将部署到webapps文件夹。但它不会自动启动。
谢谢你们帮我。
我的应用程序主要入门类:

  1. @SpringBootApplication
  2. public class SeminarbuchungApplication extends SpringBootServletInitializer {
  3. @Override
  4. protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  5. return application.sources(SeminarbuchungApplication.class);
  6. }
  7. public static void main(String[] args) {
  8. SpringApplication.run(SeminarbuchungApplication.class, args);
  9. }
  10. }

我的pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-starter-parent</artifactId>
  8. <version>2.1.7.RELEASE</version>
  9. <relativePath/> <!-- lookup parent from repository -->
  10. </parent>
  11. <groupId>de.portsol19</groupId>
  12. <artifactId>seminarbuchung</artifactId>
  13. <version>0.0.1-SNAPSHOT</version>
  14. <name>seminarbuchung</name>
  15. <description>Seminarservices for Seminarbuchung</description>
  16. <packaging>${packaging.type}</packaging>
  17. <properties>
  18. <java.version>1.8</java.version>
  19. </properties>
  20. <dependencies>
  21. <dependency>
  22. <groupId>org.springframework.boot</groupId>
  23. <artifactId>spring-boot-starter</artifactId>
  24. </dependency>
  25. <dependency>
  26. <groupId>org.springframework.boot</groupId>
  27. <artifactId>spring-boot-starter-web</artifactId>
  28. </dependency>
  29. <dependency>
  30. <groupId>org.springframework.boot</groupId>
  31. <artifactId>spring-boot-starter-actuator</artifactId>
  32. </dependency>
  33. <dependency>
  34. <groupId>org.springframework.boot</groupId>
  35. <artifactId>spring-boot-starter-security</artifactId>
  36. <version>2.2.0.RELEASE</version>
  37. </dependency>
  38. <dependency>
  39. <groupId>org.springframework.data</groupId>
  40. <artifactId>spring-data-elasticsearch</artifactId>
  41. <version>3.2.0.RELEASE</version>
  42. </dependency>
  43. <dependency>
  44. <groupId>org.springframework.boot</groupId>
  45. <artifactId>spring-boot-devtools</artifactId>
  46. <scope>runtime</scope>
  47. <optional>true</optional>
  48. </dependency>
  49. <dependency>
  50. <groupId>org.projectlombok</groupId>
  51. <artifactId>lombok</artifactId>
  52. <optional>true</optional>
  53. </dependency>
  54. <dependency>
  55. <groupId>org.springframework.boot</groupId>
  56. <artifactId>spring-boot-starter-test</artifactId>
  57. <version>2.2.0.RELEASE</version>
  58. <scope>test</scope>
  59. </dependency>
  60. <!-- Swagger -->
  61. <dependency>
  62. <groupId>io.springfox</groupId>
  63. <artifactId>springfox-swagger2</artifactId>
  64. <version>2.9.2</version>
  65. </dependency>
  66. <dependency>
  67. <groupId>io.springfox</groupId>
  68. <artifactId>springfox-swagger-ui</artifactId>
  69. <version>2.9.2</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>org.apache.httpcomponents</groupId>
  73. <artifactId>httpclient</artifactId>
  74. <version>4.5.9</version>
  75. </dependency>
  76. <dependency>
  77. <groupId>org.springframework</groupId>
  78. <artifactId>spring-web</artifactId>
  79. <version>5.1.9.RELEASE</version>
  80. </dependency>
  81. <dependency>
  82. <groupId>com.google.code.gson</groupId>
  83. <artifactId>gson</artifactId>
  84. <version>2.8.6</version>
  85. </dependency>
  86. <dependency>
  87. <groupId>org.jetbrains</groupId>
  88. <artifactId>annotations</artifactId>
  89. <version>13.0</version>
  90. <scope>compile</scope>
  91. </dependency>
  92. </dependencies>
  93. <profiles>
  94. <profile>
  95. <id>dev</id>
  96. <properties>
  97. <activatedProperties>dev</activatedProperties>
  98. </properties>
  99. <activation>
  100. <activeByDefault>true</activeByDefault>
  101. </activation>
  102. </profile>
  103. <profile>
  104. <id>int</id>
  105. <properties>
  106. <activatedProperties>int</activatedProperties>
  107. </properties>
  108. </profile>
  109. <profile>
  110. <id>prod</id>
  111. <properties>
  112. <activatedProperties>prod</activatedProperties>
  113. </properties>
  114. </profile>
  115. <profile>
  116. <id>jar</id>
  117. <properties>
  118. <packaging.type>jar</packaging.type>
  119. </properties>
  120. </profile>
  121. <profile>
  122. <activation>
  123. <activeByDefault>true</activeByDefault>
  124. </activation>
  125. <id>war</id>
  126. <properties>
  127. <packaging.type>war</packaging.type>
  128. </properties>
  129. <dependencies>
  130. <dependency>
  131. <groupId>org.springframework.boot</groupId>
  132. <artifactId>spring-boot-starter-tomcat</artifactId>
  133. <scope>provided</scope>
  134. </dependency>
  135. </dependencies>
  136. </profile>
  137. </profiles>
  138. <build>
  139. <plugins>
  140. <plugin>
  141. <groupId>org.springframework.boot</groupId>
  142. <artifactId>spring-boot-maven-plugin</artifactId>
  143. <executions>
  144. <execution>
  145. <goals>
  146. <goal>repackage</goal>
  147. </goals>
  148. </execution>
  149. </executions>
  150. </plugin>
  151. </plugins>
  152. <resources>
  153. <resource>
  154. <directory>src/main/resources</directory>
  155. <filtering>true</filtering>
  156. </resource>
  157. </resources>
  158. </build>
  159. </project>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题