千家信息网

SpringBoot打jar包遇到的xml文件丢失该怎么解决

发表于:2025-02-10 作者:千家信息网编辑
千家信息网最后更新 2025年02月10日,今天就跟大家聊聊有关SpringBoot打jar包遇到的xml文件丢失该怎么解决,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。SpringBo
千家信息网最后更新 2025年02月10日SpringBoot打jar包遇到的xml文件丢失该怎么解决

今天就跟大家聊聊有关SpringBoot打jar包遇到的xml文件丢失该怎么解决,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

SpringBoot打jar包遇到的xml文件丢失

在pom.xml的build标签中添加如下内容

指定资源路径

                    src/main/java                          **/*.xml                        true                    src/main/resources                    **/*.*            

SpringBoot打jar包遇到的一些问题

1.访问不到jsp页面

1.1 jar包中没有jsp文件,报404错误

原因:没有添加jsp打包路径

解决方案:在pom.xml中添加如下代码

                                    src/main/resources                                    **/**                                false                                        src/main/java                                                            **/*.java                                                                            src/main/webapp                                META-INF/resources                                    **/**                                        
1.2 还是访问不到页面,但不报错,一直在加载

原因:maven编译版本问题

解决方案:将版本改为1.4.2.RELEASE(目前只有这个版本打jar包才能解析jsp)

1.3 此时若还报错

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.2.RELEASE:repackage (default) on project fulan-demo: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.2.RELEASE:repackage failed: Unable to find a single main class from the following candidates

原因:没有指定启动类的位置

解决方案:在pol.xml中指定启动类

        com.xxx.xxx.xxxApplication

看完上述内容,你们对SpringBoot打jar包遇到的xml文件丢失该怎么解决有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。

0