首页 > 代码库 > maven 添加memcached.jar配置方法

maven 添加memcached.jar配置方法

针对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=D:\maven3.0\repository\com\danga\java-memcached\2.6.6\java_memcached-release_2.6.6.jar -DpomFile=D:\maven3.0\repository\com\danga\java-memcached\2.6.6\java-memcached-2.6.6.pom

目录改为自已的

 

<!-- memcached -->  
        <dependency>  
            <groupId>com.danga</groupId>  
            <artifactId>java-memcached</artifactId>  
            <version>2.6.6</version>  
        </dependency>  

 

其中java-memcached-2.6.6.pom的内容为:

<?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.danga</groupId>    
  <artifactId>java-memcached</artifactId>    
  <version>2.6.6</version>    
<dependencies>    
    <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.6</version>    
    </dependency>    
</dependencies>    
</project>    

 

maven 添加memcached.jar配置方法