转载请注明出处:http://blog.csdn.net/l1028386804/article/details/48440723 针对java项目添加 memcahced
在mvnrepository 找了半天也没找到memcached.jar的配置xml,
由于目前java memcached client没有官方的maven repository可供使用,因此使用时需要手动将其安装到本地repository。java memcached client的jar包下载地址:https://github.com/gwhalin/Memcached-Java-Client/downloads 目前2.6.6版本的java memcached client要依赖slf4j-simple、slf4j-api、commons-pool三个包,依此我们可以为其编辑一个pom文件,将java memcached client的jar包和pom文件一起安装,解决java memcached client对其他jar包的依赖。安装命令:
mvn install:install-file -Dfile=F:\comm\youboy\java_memcached-release_2.6.6\java_memcached-release_2.6.6.jar -DpomFile=F:\comm\youboy\java_memcached-release_2.6.6\pom.xml
目录改为自已的
在项目中就可以引用了<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lyz</groupId>
<artifactId>lyz</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.danga</groupId>
<artifactId>java-memcached</artifactId>
<version>2.6.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
</project>
|