window环境使用maven手动安装jar包

kaptcha-2.3.jar为例

kaptcha-2.3.ja的下载地址点击打开链接

1.将 kaptcha-2.3.jar放到C:\Users\Guo目录下
2.window+R--> cd  C:\Users\Guo
3.执行命令 
mvn install:install-file -DgroupId=com.google.code.kaptcha -DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar -Dfile=kaptcha-2.3.jar
如图:

出现“BUILD SUCCESS” 成功安装

4.打开maven仓库D:\HGDE\maven-dependcies\com\google\code\kaptcha\kaptcha\2.3看到文件列表如下


表示已经成功安装

在pom.xml中配置,就无需再下载kaptcha.jar,直接使用

<dependency>
    <groupId>com.google.code.kaptcha</groupId>
    <artifactId>kaptcha</artifactId>
    <version>2.3</version>
</dependency>

说明,本地使用pom文件下载kaptcha-2.3.jar的时候,一直卡住,只好去maven官网手动下载了kaptcha-2.3.jar,然后自行安装,亲测可用。

-------------------------------------------------------------------------------------------------------------------------------------------------------

今天安装jar包的时候,安装失败,报错信息如下

C:\Users\Guo>mvn install-file -DgroupId=com.ctg.mq -DartifactId=ctgmq-rocketmq-t
ools -Dversion=2.2.4_P1 -Dpackaging=jar -Dfile=ctgmq-rocketmq-tools-2.2.4_P1.jar

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.087 s
[INFO] Finished at: 2017-10-18T14:02:10+08:00
[INFO] Final Memory: 6M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
 in this directory (C:\Users\Guo). Please verify you invoked Maven from the corr
ect directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProject
Exception

C:\Users\Guo>
去网络上找了一下原因,基本都是说两方便的原因:一、jar包的路径不可以有空格,我这里可以确认本地是没有空格,把解决方案给否定;二、需要在c盘根目录下执行,也不行。我只好去查看了本地maven的环境变量,也没问题。那问题还是出在命令上了,翻出来上面成功的截图,果然,命令有错误,漏掉了“install:”,加上之后,执行命令,安装成功。此事提醒我,一定要 细心,命令尽量去复制,不要直接手写。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值