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>
相关推荐
Ujimatsu7 分钟前
数据分析相关面试题-Python部分
大数据·python·数据分析
未知鱼9 分钟前
Python安全开发之简易Xss检测工具(详细注释)
python·安全·xss
芒果披萨11 分钟前
sql存储过程
java·开发语言·数据库
楚Y6同学12 分钟前
QT C++ 实现图像查看器
开发语言·c++·qt·图像查看
yaoxin52112317 分钟前
368. Java IO API - 基本文件属性
java·开发语言·python
程序媛徐师姐29 分钟前
Python基于机器学习的就业岗位推荐系统【附源码、文档说明】
python·机器学习·python机器学习·就业岗位推荐系统·python就业岗位推荐系统·python机器学习就业推荐·就业岗位推荐
建军啊30 分钟前
java审计进阶
java·开发语言·python
2401_8896269232 分钟前
Java流程控制与方法全解析
java·开发语言
码界筑梦坊35 分钟前
329-基于Python的交通流量数据可视化分析系统
开发语言·python·信息可视化·数据分析·django·vue·毕业设计
yong999038 分钟前
带挂载的四轴飞行器模型预测控制(MPC) MATLAB实现
开发语言·matlab