maven打包包含本地jar包

本文详细介绍如何使用Maven进行项目打包,包括如何在pom.xml中配置依赖和插件,以及如何指定本地jar包的路径,确保它们被正确包含在最终的打包文件中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

maven打包记录

包含本地jar包
全局只修改pom.xml即可

添加依赖

1、groupId随便填
2、artifactId随便填
3、version随便填
4、scope填system
5、systemPath填jar包路径,${project.basedir}为当前项目路径

<dependency>
            <groupId>xxx</groupId>
            <artifactId>aaa</artifactId>
            <version>1.0.3</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/xxx/aaa.jar</systemPath>
        </dependency>

添加插件

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

添加包含jar包

<resources>
            <resource>
                <directory>lib</directory>
                <targetPath>/BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
        </resources>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值