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>
相关推荐
dev派1 小时前
AI Agent 系统中的常用 Workflow 模式(2) Evaluator-Optimizer模式
python·langchain
前端付豪3 小时前
AI 数学辅导老师项目构想和初始化
前端·后端·python
用户0332126663673 小时前
将 PDF 文档转换为图片【Python 教程】
python
悟空爬虫4 小时前
UV实战教程,我啥要从Anaconda切换到uv来管理包?
python
dev派5 小时前
AI Agent 系统中的常用 Workflow 模式(1)
python·langchain
明月_清风6 小时前
从“能用”到“专业”:构建生产级装饰器与三层逻辑拆解
后端·python
曲幽16 小时前
数据库实战:FastAPI + SQLAlchemy 2.0 + Alembic 从零搭建,踩坑实录
python·fastapi·web·sqlalchemy·db·asyncio·alembic
用户83562907805121 小时前
Python 实现 PowerPoint 形状动画设置
后端·python
ponponon1 天前
时代的眼泪,nameko 和 eventlet 停止维护后的项目自救,升级和替代之路
python
Flittly1 天前
【从零手写 ClaudeCode:learn-claude-code 项目实战笔记】(5)Skills (技能加载)
python·agent