这个问题主要是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必不可少
最后,如果小编的方法行不通,请百度不断尝试 吧
最后
以上就是简单小白菜最近收集整理的关于spring boot项目eclipse中启动访问jsp/html,打包不能访问jsp/html问题总结的全部内容,更多相关spring内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复