springboot~引用地址jar包的方法


有些类库我们会放在本地resources目录,当然如果公用仓库里有它,并且是免费的,还是建议直接引用仓库里的,这样在版本更新上和源代码体积上都是有优势的,下面解决引用本地jar的方法。

资源文件

/resources/lib/abc.jar

在pom里添加引用

<dependencies>
  <dependency>
            <groupId>com.bdyh.common</groupId>
            <artifactId>common</artifactId>
            <version>0.0.1</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
        </dependency>
</dependencies>

pom里添加本地文件支持

<build>
     <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
    </plugins>
</build>

这样,本地的jar包就算了引到项目里了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM