idea打包jar发布到Linux不能加载jsp

tech2025-02-07  10

这是因为你的所有的jsp页面没有打包到jar里,需要在pom文件里加入jsp解析需要的工具

解决方案:

(1)

切记version-一定要是1.4.2.RELEASE!!!

<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.4.2.RELEASE</version> </plugin>

(2)

配置 < resources>将webapp打包进target/classes 目录,其中< targetPath>META-INF/resources</ targetPath> 指定将webapp打包到target/classes 目录的META-INF/resources 目录下,必须这样配置,否则会出错.

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.4.2.RELEASE</version> </plugin> </plugins> <!-- 配置 < resources>将webapp打包进target/classes 目录,其中< targetPath>META-INF/resources</ targetPath> 指定将webapp打包到target/classes 目录的META-INF/resources 目录下,必须这样配置,否则会出错 --> <resources> <resource> <directory>src/main/webapp</directory> <targetPath>META-INF/resources</targetPath> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources> </build>

 

结果就可以访问成功了

 

 

最新回复(0)