maven编译时引入外部jar

<!-- 1.添加对工程lib目录中jar的编译 -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.8</source>

<target>1.8</target>

<encoding>UTF-8</encoding>

<compilerArguments>

<extdirs>${project.basedir}/src/main/resources/lib</extdirs>

</compilerArguments>

</configuration>

</plugin>

<!-- 2.编译时引入独立jar包 -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.8</source>

<target>1.8</target>

<encoding>UTF-8</encoding>

<compilerArguments>

<verbose />

<!-- 替换为所引用jar的路径 -->

<bootclasspath>${JAVA_HOME}\jre\lib\rt.jar</bootclasspath>

</compilerArguments>

</configuration>

</plugin>

也可以使用下面的方式

  1. <dependency>
  2. <groupId>com.example</groupId>
  3. <artifactId>your-artifact-id</artifactId>
  4. <version>1.0.0</version>
  5. <scope>system</scope>
  6. <systemPath>${project.basedir}/libs/your-jar-file.jar</systemPath>
  7. </dependency>
相关推荐
企鹅的蚂蚁4 分钟前
【ESP32-S3开发踩坑】C++野指针引发的LoadProhibited死机与CMake依赖锁死排查
开发语言·c++
kcuwu.5 分钟前
Python进阶:生成器与协程,高效并发编程的核心实践
windows·python·php
XiaoQiao6669997 分钟前
python 简单题目练手【详解版】【1】
开发语言·python
Kiling_07047 分钟前
Java多态、final与抽象类:面向对象编程进阶指南
java·开发语言
ZC跨境爬虫11 分钟前
极验滑动验证码自动化实战:背景提取、缺口定位与Playwright滑动模拟
前端·爬虫·python·自动化
智算菩萨13 分钟前
【Python图像处理】2 数字图像基础与Python图像表示
开发语言·图像处理·python
Jasmine_llq1 小时前
《B3840 [GESP202306 二级] 找素数》
开发语言·c++·试除法·顺序输入输出算法·素数判定算法·枚举遍历算法·布尔标记算法
梁山好汉(Ls_man)1 小时前
鸿蒙_ArkTS解决Duplicate function implementation错误
开发语言·华为·typescript·harmonyos·鸿蒙
xiaoshuaishuai81 小时前
Git二分法定位Bug
开发语言·python
so2F32hj21 小时前
一款Go语言Gin框架DDD脚手架,适合快速搭建项目
开发语言·golang·gin