这个问题主要是pom.xml
中build
的问题。
首先是你的jsp
资源打包放入META-INF/resources
中,这样才能访问到jsp
和html
才能打包到你的项目中去。
```xml
<build>
<resources>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.2.RELEASE</version>
<configuration>
<mainClass>com.asphalt.WebApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 忽略无web.xml警告 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
其次是 <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>
添加如下版本
<version>1.4.2.RELEASE</version> 这个version必不可少
最后,如果小编的方法行不通,请百度不断尝试 吧