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>
相关推荐
逻极10 分钟前
OpenClaw「Clawdbot/Moltbot」 深入解析:核心架构深度剖析
python·ai·架构·agent·ai编程·moltbot·openclaw
sayang_shao12 分钟前
C++ ONNX Runtime 与 Python Ultralytics 库实现 YOLOv8 模型检测的区别
c++·python·yolo
曹牧13 分钟前
Java:强类型转换
开发语言·python
wuguan_16 分钟前
C#之线程
开发语言·c#
LXS_35719 分钟前
STL - 函数对象
开发语言·c++·算法
爱学习的阿磊22 分钟前
Python入门:从零到一的第一个程序
jvm·数据库·python
木千24 分钟前
Qt5.15.2安装MSVC2019编译器
开发语言·qt
naruto_lnq26 分钟前
编写一个Python脚本自动下载壁纸
jvm·数据库·python
仟濹28 分钟前
【Java加强】1 异常 | 打卡day1
java·开发语言·python
去往火星31 分钟前
Qt6 CMake 中引入 Qt Linguist 翻译功能
开发语言·qt