> 文章列表 > #java mavn安装图像验证码jar失败kaptcha-2.3.2.jar#

#java mavn安装图像验证码jar失败kaptcha-2.3.2.jar#

#java mavn安装图像验证码jar失败kaptcha-2.3.2.jar#

场景:在登录的时候添添加图形验证码功能,使用 com.google.code.kaptcha开发图像验证码,。通过pom引入依赖一直红色提示,找打不到依赖,如图所示


原因:kaptcha-2.3.jar 没有放在mavan的中央仓库

解决方案,需要先现在jar 包,然后安装到本地仓库

1:下载kaptcha-2.3.2.jar

使用地址http://code.google.com/p/kaptcha/downloads/list

下载。如链接不上下载失败,可以使用如下地址

https://mvnrepository.com/artifact/com.github.penggle/kaptcha/2.3.2

如图所示:

下载成功,放到一个目录中

2:安装:

使用cmd命令打开,窗口,cd 切换到这个jar的路径下

提示:通过cd找到这个目录,不能直接到这个目录下打开powershell窗口,否则安装失败,,提示错误[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (D:\\app\\ideatool\\basejars). Please verify you invoked Maven from the correct directory. -> [Help 1]
 

正常流程:

 安装成功

        mvn install:install-file -DgroupId=com.google.code -DartifactId=kaptcha -Dversion=2.3.2  -Dpackaging=jar  -Dfile=kaptcha-2.3.2.jar

3:使用:

在pom中使用 如图:

 

如果idea还是显示红色,不可用

在项目下执行命令 mvn  -U idea:idea 

关掉idea 重新打开