以demo-1.0.jar为例
1.保证mvn命令能在windows的cmd命令下执行。
2.新建文件夹myjar,将demo-1.0.jar移动到myjar下。
3.在myjar中创建pom.xml文件
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.xxxxx.demo</groupId>
<artifactId>demo</artifactId>
<version>1.0</version>
<name>demo</name>
<description></description>
</project>
4.在cmd命令中切换到~\myjar\目录,然后执行命令mvn install:install-file -Dfile=demo-1.0.jar -DgroupId=cn.xxxxx.demo -DartifactId=demo -Dversion=1.0 -Dpackaging=jar
5.此时能看到jar包上传成功
6.在IDEA中需要重新build项目。然后如果还报找不到jar包中文件,此时查看
中是否包含刚才上传的jar包,如果不存在,则去idea中手动添加依赖
步骤:File-》Project Structure-》Project Settings下的Modules,然后选择需要依赖进入的项目,在右侧“+”号中选择Libraries,选择刚才导入到maven仓库的jar包,点击Add Selected按钮。然后选中加入进来的依赖jar,点击Apply-》OK,恭喜你,完成了!