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>
相关推荐
MATLAB代码顾问16 小时前
改进遗传算法(IGA)求解作业车间调度问题(JSSP)——附MATLAB代码
开发语言·matlab
syker16 小时前
AIFerric深度学习框架:自研全栈AI基础设施的技术全景
开发语言·c++
HSunR16 小时前
dify 搭建ai作业批改流
开发语言·前端·javascript
zhaoyong22217 小时前
MySQL 存储过程中字符集与排序规则不匹配导致查询性能下降的解决方案
jvm·数据库·python
sinat_3834373617 小时前
golang如何从Python转型Go开发_golang从Python转型Go开发攻略
jvm·数据库·python
代码不加糖17 小时前
2026 跨境电商独立站实战:从 0 到 1 搭建高转化 SaaS 商城(附源码)
开发语言·前端·javascript
rockey62717 小时前
基于AScript的python3脚本语言发布啦!
python·c#·.net·script·python3·eval·expression·function·动态脚本
时空系17 小时前
第9篇:成员功能——为结构体添加能力 Rust中文编程
开发语言·网络·rust
gqk0117 小时前
Python入门
python
MATLAB代码顾问17 小时前
多种群协同进化算法(MPCE)求解大规模作业车间调度问题——附MATLAB代码
开发语言·算法·matlab