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>
相关推荐
颜*鸣&空41 分钟前
QT程序实现串口通信案例
开发语言·qt
烤汉堡1 小时前
Python入门到实战:post请求+cookie+代理
爬虫·python
无限进步_1 小时前
C语言动态内存的二维抽象:用malloc实现灵活的多维数组
c语言·开发语言·数据结构·git·算法·github·visual studio
luod1 小时前
Python异常链
python
froginwe111 小时前
Maven 仓库概述
开发语言
我不是QI2 小时前
周志华《机器学习---西瓜书》 一
人工智能·python·机器学习·ai
今天没ID2 小时前
Python 编程实战:从基础语法到算法实现 (1)
python
二川bro2 小时前
Python在AI领域应用全景:2025趋势与案例
开发语言·人工智能·python
棒棒的皮皮2 小时前
【Python】Open3d用于3D测高项目
python·3d·open3d