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>
相关推荐
AI开发发烧友4 分钟前
LangGraph多Agent协作实战:以物流售前场景为例的5 Agent工作流设计
python
码云骑士8 分钟前
70-多Agent协作-CrewAI-AutoGen-角色分工与信息传递协议
python
浪客川21 分钟前
Android的SystemUI的启动流程简析
android·开发语言
-银雾鸢尾-35 分钟前
C#中的抽象类与抽象方法
开发语言·c#
Hachi被抢先注册了39 分钟前
Skills总结
python
用户0332126663671 小时前
使用 Python 在 PowerPoint 中创建折线图和条形图
python
萧瑟余晖1 小时前
JDK 20 新特性详解
java·开发语言
benchmark_cc1 小时前
如何用 Python 进行多周期 K 线合成与时区对齐?基于 QuantDash 与 Pandas 的量化数据清洗实战(附 GitHub 源码)
开发语言·python·github·盯盘·pandas·quantdash·量化数据
不如语冰1 小时前
AI大模型入门-参数的传递
数据结构·人工智能·pytorch·python
用户6760840656171 小时前
GraphBLAS_01_图的稀疏表示
python