1、需要知道groupId、artifactId、version
通过 cmd命令行执行 mvn install:install-file ,比如安装sigar.jar如下;
mvn install:install-file -DgroupId=org.hyperic -DartifactId=sigar -Dversion=1.6.5 -Dpackaging=jar -Dfile=C:Users estDesktop监控资料sigar.jar
运行cmd进入一个命令窗口,然后输入如下的命令:
C:Users est>mvn install:install-file -DgroupId=org.hyperic -DartifactId=sig
ar -Dversion=1.6.5 -Dpackaging=jar -Dfile=C:Users estDesktop监控资料siga
r.jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom
---
[INFO] Installing C:Users estDesktop监控资料sigar.jar to D:mavenReposi
toriesorghypericsigar1.6.5sigar-1.6.5.jar
[INFO] Installing C:Users estAppDataLocalTempmvninstall3535988700040635
257.pom to D:mavenRepositoriesorghypericsigar1.6.5sigar-1.6.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.183s
[INFO] Finished at: Wed May 20 09:03:50 CST 2015
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
当看到有BUILD SUCCESS字样出现就表明jar包已经安装成功了。