iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > Python >SpringBoot打jar包遇到的xml文件丢失的解决方案
  • 663
分享到

SpringBoot打jar包遇到的xml文件丢失的解决方案

2024-04-02 19:04:59 663人浏览 八月长安

Python 官方文档:入门教程 => 点击学习

摘要

目录SpringBoot打jar包遇到的xml文件丢失在pom.xml的build标签中添加如下内容springBoot打jar包遇到的一些问题1.访问不到jsp页面1.1 jar包

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

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

指定资源路径

在这里插入图片描述


<resources>    
    <resource>    
        <directory>src/main/java</directory>  
        <includes>    
            <include>***.*</include>
        </includes>
    </resource>
</resources>

SpringBoot打jar包遇到的一些问题

1.访问不到jsp页面

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

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

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


<build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>***.java
                    </exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/WEBapp</directory>
                <!--注意此次必须要放在此目录下才能被访问到 -->
                <targetPath>META-INF/resources</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>

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中指定启动类


<properties>
        <start-class>com.xxx.xxx.xxxApplication</start-class>
</properties>

以上为个人经验,希望能给大家一个参考,也希望大家多多支持编程网。

--结束END--

本文标题: SpringBoot打jar包遇到的xml文件丢失的解决方案

本文链接: https://www.lsjlt.com/news/136928.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作