本地maven仓库中存在jar,远程仓库没有该jar,导致项目的pom.xml文件报错

本地maven仓库中存在jar,远程仓库没有该jar,导致项目的pom.xml文件报错,但是不影响项目的运行,因为本地已经存在该jar如下:

本地maven仓库中存在jar,远程仓库没有该jar,导致项目的pom.xml文件报错

解决方案:

需要用到Maven如下命令:

mvn install:install-file  
-DgroupId=包名  
-DartifactId=项目名  
-Dversion=版本号  
-Dpackaging=jar  
-Dfile=jar文件所在路径 

执行以下命令:

mvn install:install-file -Dfile=D:\lib\jnotify-0.94.jar -DgroupId=net.contentobjects -DartifactId=jnotify -Dversion=0.94 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true

在pom.xml中添加如下内容:

<dependency>
            <groupId>net.contentobjects</groupId>
            <artifactId>jnotify</artifactId>
            <version>0.94</version>
            <<type>jar</type>

</dependency>

然后把pom.xml中的引用删除重新加入即可。