美文网首页
springboot bug实例7

springboot bug实例7

作者: 凉风拂面秋挽月 | 来源:发表于2019-10-30 21:28 被阅读0次

bug:sprinboot打包引入额外jar包出错。
最近项目需要将springboot打包部署到云主机上,在打包的过程中,出现错误,显示缺少某些类。查看这些类发现,这些类位于额外引入的jar包上(该jar包为第三方的sdk,不属于maven)。因为jar包为lib引入(build path)。
那么项目中除了从pom中添加依赖包,如何以添加本地的jar包呢?
1、在src下新建目录lib,将jar包添加到lib中
2、在pom文件里添加配置以下属性,就可以使用jar包了

        <dependency>
            <groupId>alidao-jxe</groupId>
            <artifactId>alidao-jxe</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/lib/alidao-jxe-6-1.0.0.jar</systemPath>
        </dependency>

3、如果打包jar,就需要再配置下,如下,关键最后个resource

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/webapp</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/lib</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
        </resources>
    </build>

完成。

相关文章

  • springboot bug实例7

    bug:sprinboot打包引入额外jar包出错。最近项目需要将springboot打包部署到云主机上,在打包的...

  • springboot bug实例6

    在使用springboot+redis+自定义CacheManager来用json格式来序列化javabean的时...

  • springboot bug实例5

    今天在阿里云通过docker部署了redis数据库,通过本地的客户端Redis Desktop Manager连接...

  • springboot bug实例2

    今天在验证springboot的Thymeleaf功能时,书写html代码,但却发现其背景及字体样式很奇怪,且最重...

  • springboot bug实例3

    当在测试springboot整合jdbc的时候,一直无法连接本地数据库,报错信息为The server time ...

  • springboot bug实例8 :javaBean的规范导致

    在springboot项目中,通过@RequestBody来将json数据封装成JavaBean的时候出现了问题。...

  • Springboot+Elasticsearch整合实例

    Springboot+Elasticsearch整合实例 这篇文章主要介绍Springboot与Elasticse...

  • dubbo bug实例

    当在springboot2.x中使用dubbo 0.1.0版本出现NoClassDefFoundError错误,改...

  • 08.插件之FindBugs

    FindBugs是一个在Java程序中查找bug的程序,它查找bug模式的实例,也就是可能出错的代码实例。Find...

  • 20分钟springboot搭建dubbo服务

    本文介绍本人通过springboot搭建dubbo服务的项目实例,此服务为dubbo+springboot+myb...

网友评论

      本文标题:springboot bug实例7

      本文链接:https://www.haomeiwen.com/subject/gxhavctx.html