ElasticSearch插件demo

环境:

操作系统:win7

elasticsearch版本:5.4.4

java:1.8


参考文章:

1、Elasticsearch权威指南(中文版)

2、Elasticsearch笔记五之java操作es

3、java操作ElasticSearch(es)进行增删查改操作

4、ElasticSearch入门-增删改查(CRUD)

5、elasticsearch——Java API的使用

6、elasticsearch源码分析之plugin的开发

7、Elasticsearch 5.X下JAVA API使用指南

——————————————————————————————————————

8、elasticsearch5.2.2 插件开发(一)

9、elasticsearch5.2.2 插件开发(二) 第一个有实际功能的插件 - CSDN博客

10、elasticsearch5.2.2 插件开发(三)ScriptPlugin 的实现 - CSDN博客

——————————————————————————————————————

11、Maven通俗讲解

12、如何添加本地JAR文件到Maven项目中 - CSDN博客

13、Maven Repository: weka

14、maven系列--maven添加第三方、本地依赖 - CSDN博客

15、Maven配置项目依赖使用本地仓库的方法汇总 - EasonJim - 博客园


有关打包部分的视频在我的百度网盘 

链接:https://pan.baidu.com/s/1DuIWN2uDtcA8guP_Ny91Vw 密码:tj65


第一部分:代码

一、创建maven项目

首先创建一个maven项目,填写Group Id为com.plugin和Artifact Id为esPlugin。其中Artifact Id是项目名,Group Id是项目中包的名字。



二、修改pom.xml配置文件

修改pom.xml文件,然后右键项目名->maven->update maven。会发现在Maven Dependencies文件夹下多了很多包(见下图),这些都是pom.xml文件添加进去的依赖,省去了手动导包的麻烦。(包全是在maven的中央仓库下载到本地的,pom.xml代码见页面底部。)



三、核心代码实现

代码目录如下(用的是之前的项目的截图,忽略顶部的包名),在文后的链接中下载项目,会有这么多包,真正用到的和需要修改的类是TasteEventRestAction.java,这里面包括注册URL,以及执行对应的操作。


[java]  view plain  copy
  1. package com.taste.elasticsearch_taste.rest;  
  2.   
  3. import static com.taste.elasticsearch_taste.action.LoggerUtils.emitErrorResponse;  
  4. import static org.elasticsearch.rest.RestRequest.Method.POST;  
  5.   
  6. import java.io.File;  
  7. import java.io.IOException;  
  8.   
  9. import org.elasticsearch.action.ActionListener;  
  10. import org.elasticsearch.action.search.SearchRequest;  
  11. import org.elasticsearch.action.search.SearchRequestBuilder;  
  12. import org.elasticsearch.action.search.SearchResponse;  
  13. import org.elasticsearch.client.node.NodeClient;  
  14. import org.elasticsearch.common.inject.Inject;  
  15. import org.elasticsearch.common.settings.Settings;  
  16. import org.elasticsearch.common.xcontent.ToXContent;  
  17. import org.elasticsearch.common.xcontent.XContentBuilder;  
  18. import org.elasticsearch.index.query.QueryBuilders;  
  19. import org.elasticsearch.rest.BaseRestHandler;  
  20. import org.elasticsearch.rest.BytesRestResponse;  
  21. import org.elasticsearch.rest.RestController;  
  22. import org.elasticsearch.rest.RestRequest;  
  23. import org.elasticsearch.rest.RestStatus;  
  24. import org.elasticsearch.rest.action.search.RestSearchAction;  
  25. import org.elasticsearch.search.SearchHits;  
  26.   
  27. import com.pligin.esPlugin.action.TasteEventAction;  
  28. import com.pligin.esPlugin.common.TasteEventRequestBuilder;  
  29. import com.pligin.esPlugin.common.TasteEventResponse;  
  30.   
  31. //我项目中的类  
  32. //import ding.util.ESUtil.ActionParameter;  
  33. //import ding.util.WEKAUtil.MeachineLearningBuilder;  
  34.   
  35.   
  36. public class TasteEventRestAction extends BaseRestHandler{  
  37.     public ActionParameter parameter;  
  38.       
  39.     @Inject  
  40.     public TasteEventRestAction(final Settings settings,final RestController restController) {  
  41.         super(settings);  
  42.         restController.registerHandler(RestRequest.Method.GET, "/_taste/{action}"this); // 注册URL1,该URL中最后的字符串赋给变量action  
  43.         restController.registerHandler(RestRequest.Method.GET, "/_taste"this); // 注册URL2  
  44.     }  
  45.       
  46.     @Override  
  47.     protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {  
  48.         if (request.method() == POST && !request.hasContent()) {  
  49.             return channel -> emitErrorResponse(channel, logger, new IllegalArgumentException("Request body was expected for a POST request."));  
  50.         }  
  51.         String action = request.param("action");  
  52.           
  53.         // 遇到URL1,执行createDoSomethingResponse  
  54.         if (action != null) {   
  55.             logger.info("do something action -- ESData & MeachineLearning");  
  56.             return createDoSomethingResponse(request, client);  
  57.           
  58.         // 遇到URL2,执行createMessageResponse  
  59.         } else {  
  60.             logger.info("do Message action -- do anything without parameter");  
  61.             return createMessageResponse(request);    
  62.         }  
  63.     }  
  64.       
  65.     // 一、对应URL为 /_taste/{action}  
  66.     private RestChannelConsumer createDoSomethingResponse(RestRequest request, NodeClient client){  
  67.         /*这里request存放的是URL,使用request.param("action")可以获得URL中的action变量值(可作为参数使用) 
  68.         我这里对action做了一个解析,我的参数规格是 
  69.         http://127.0.0.1:9200/_taste/index=logstash-20180323&from=0&size=100&clfName=J48&classifyAttributeName=tes_tims 
  70.         可以通过 parameter.Index, parameter.From, parameter.Size获得action中的参数 
  71.         然后通过前几个包里面的TasteEventRequestBuilder等类,在es里面进行查询,得到输出myresponse 
  72.         最后使用异步编程,即return channel,可以对es传出来的数据进行处理,处理结果作为String,加入builder里面,由channel返回 
  73.         */  
  74.         String action = request.param("action");  
  75.         this.parameter= new ActionParameter(action);  
  76.           
  77.         // 1、通过parameter进行数据查询,构造自定义的request请求  
  78.         final TasteEventRequestBuilder actionBuilder=new TasteEventRequestBuilder(client);  
  79.         SearchRequestBuilder requestBuilder = client.prepareSearch(parameter.Index).setQuery(QueryBuilders.matchAllQuery()).setFrom(parameter.From).setSize(parameter.Size).setExplain(true);  
  80.         SearchRequest searchRequest=new SearchRequest();  
  81.         try {  
  82.             RestSearchAction.parseSearchRequest(searchRequest, request, null);  
  83.         } catch (IOException e1) {  
  84.             logger.debug("Failed to emit response.", e1);  
  85.             e1.printStackTrace();  
  86.         }  
  87.         actionBuilder.setSearchRequest(requestBuilder);  
  88.         return channel -> client.execute(TasteEventAction.INSTANSE, actionBuilder.request(),new ActionListener<TasteEventResponse>() {  
  89.             @Override  
  90.             public void onResponse(TasteEventResponse response) {  
  91.                 try{  
  92.                     // 2、获得查询数据  
  93.                     SearchResponse myresponse=response.getSearchResponse();  
  94.                     SearchHits ESHits = myresponse.getHits();  
  95.                       
  96.                     // 3、调用机器学习功能  
  97.                     String res = new MeachineLearningBuilder().getOutput(ESHits, parameter);  
  98.                       
  99.                     //将response转换成json类型,不过这个未转化成功  
  100.                     XContentBuilder builder = channel.newBuilder();  
  101.                     builder.startObject();  
  102.                     builder.field("res", res);  
  103.                     //response.toXContent(builder, request); // 此处可以写个覆盖函数  
  104.                     builder.endObject();  
  105.                     channel.sendResponse( new BytesRestResponse(RestStatus.OK, builder));  
  106.                 }catch(Exception e){  
  107.                     logger.debug("Failed to emit response.", e);  
  108.                     onFailure(e);  
  109.                 }  
  110.             }  
  111.               
  112.             @Override  
  113.             public void onFailure(Exception e) {  
  114.                 emitErrorResponse(channel, logger, e);  
  115.             }  
  116.         });  
  117.     }  
  118.       
  119.       
  120.       
  121.       
  122.     // 2、对应URL为 /_taste  
  123.     private RestChannelConsumer createMessageResponse(RestRequest request) {    
  124.         // 也可以像这里面一样,不使用es里面的通信,直接对builder进行处理,然后在builder里面写入自定义的一些东西,最后可以输出在网页上  
  125.           
  126.         return channel -> {    
  127.             Message message = new Message();  
  128.             XContentBuilder builder = channel.newBuilder();    
  129.             builder.startObject();  
  130.             message.toXContent(builder, request);  
  131.             builder.endObject();    
  132.             channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder));    
  133.         };    
  134.     }  
  135.       
  136.     class Message implements ToXContent {    
  137.         @Override    
  138.         public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {    
  139.             return builder.field("message""This is my first plugin      Run without error");    
  140.         }    
  141.     }  


四、插件打包与安装

在./src/main下创建 resources 文件夹,在文件夹中创建 plugin-descriptor.properties 文件,

[java]  view plain  copy
  1. description=elasticsearch-esPlugin-5.4.0.1 for Elasticsearch #随便写  
  2. version=5.4.1 #es的版本  
  3. name=esPlugin #写项目名  
  4. site=${elasticsearch.plugin.site}  
  5. jvm=true  
  6. classname=com.plugin.esPlugin.plugin.TastePlugin #根据自己的TastePlugin的目录修改  
  7. java.version=1.8  
  8. elasticsearch.version=5.4.1  
  9. isolated=${elasticsearch.plugin.isolated}  
打包,在pom.xml所在目录,进入cmd,输入目录 mvn clean install,会 在打包后在target目录下将看到新生成的jar包。 然后新建一个文件夹,文件夹名字为elasticsearch,将这个jar包放入这个文件夹,并将之前写的plugin-descriptor.properties文件复制一份放入这个文件夹(注意文件夹的名字一定为elasticsearch,不能为其他名字!!)

    最后将这个文件夹压缩为zip,压缩后文件的名字可以随便起,这里起为elasticseach_taste_5.4.1.zip,然后在那个最开始下载的软件版的elasticsearch5.4.1的bin目录下执行elasticsearch-plugin install file:F:/java_programming/elasticsearch_taste1/target/elasticseach_taste_5.4.1.zip操作安装插件,安装好可以在plugins文件夹下看到自定义的插件,将这个插件复制一份到源码的core中的plugins文件夹下也可以。


五、demo的实验效果




第二部分、超简洁的命令介绍

—————————————————————————————————

1、使用该命令对插件(maven项目)进行打包

mvn clean install 

—————————————————————————————————

2、删除之前安装的插件(不删除的话会重复占用URL报错)

elasticsearch-plugin remove esmlplugin2 

elasticsearch-plugin remove taste

3、安装新的插件(已经压缩为F盘下的taste-5.4.0.1.zip)
elasticsearch-plugin install file:F:/esmlplugin2-5.4.0.1.zip
elasticsearch-plugin install file:F:/taste-5.4.0.1.zip


这个命令效果如下图所示,完成之后,会在 elasticsearch5.4.4/plugin 目录下生成名为taste的文件夹(文件夹名字根据.property中的name确定),可以直接将此文件夹复制到源码中 /core/plugin 目录下,在源码中运行。


—————————————————————————————————

4、启动
elasticsearch.bat

第三部分:测试类介绍

测试类在com.taste.elasticsearch_taste包下,核心代码是TasteEventRestTest类。该类功能是发出http的get请求,获取数据。代码如下:

[java]  view plain  copy
  1. package com.taste.elasticsearch_taste;  
  2.   
  3. import java.net.InetSocketAddress;  
  4.   
  5. import org.apache.http.HttpResponse;  
  6.   
  7. import org.apache.http.client.methods.HttpGet;  
  8.   
  9. import org.apache.http.impl.client.CloseableHttpClient;  
  10. import org.apache.http.impl.client.HttpClientBuilder;  
  11. import org.apache.http.util.EntityUtils;  
  12. import org.elasticsearch.common.network.NetworkAddress;  
  13.   
  14. //import org.elasticsearch.common.xcontent.XContentType;  
  15.   
  16. public class TasteEventRestTest extends TastePluginTest {  
  17.     public void test_recommended_items_from_user() throws Exception {  
  18. //      final String index = "blog";  
  19. //      XContentType type = randomFrom(XContentType.values());  
  20.         try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {  
  21.             InetSocketAddress[] endpoint = cluster().httpAddresses();  
  22.             this.restBaseUrl = "http://" + NetworkAddress.format(endpoint[0]);  
  23.               
  24.             String s1 = "/_taste/parameter?index=blog&from=0&size=10&clfName=RandomForest&classifyAttributeName=classify";  
  25. //          String s2 = "/_taste";  
  26.             HttpGet get=new HttpGet(restBaseUrl + s1);  
  27.             System.out.println("post请求已发送11111111111");  
  28.             HttpResponse response = httpClient.execute(get);  
  29.             System.out.println("post请求已发送");  
  30.               
  31.             System.out.println("得到返回值:");  
  32.             if(response.getStatusLine().getStatusCode()==200){//如果状态码为200,就是正常返回  
  33.                 String result=EntityUtils.toString(response.getEntity());  
  34.                 //得到返回的字符串  
  35.                 System.out.println(result);  
  36.             }  
  37.               
  38.         }  
  39.    }  
  40. }  

在测试类中开启的es里是没有任何数据的,需要在HttpGet get=new HttpGet(restBaseUrl + s1);这里加上断点,debug到这句话,然后使用git想es里面输入数据,下面给出一个数据样例。然后继续debug,会执行项目第一部分中的核心代码。

[java]  view plain  copy
  1. curl -XPUT http://127.0.0.1:9200/blog  
  2. curl -XPUT http://127.0.0.1:9200/blog/es/1 -d '{"a":"1","b":"3","c":"4","d":"6","e":"8","path":"xxx","classify":"a"}'  
  3. curl -XPUT http://127.0.0.1:9200/blog/es/2 -d '{"a":"4","b":"1","c":"7","d":"7","e":"7","path":"yyy","classify":"a"}'  
  4. curl -XPUT http://127.0.0.1:9200/blog/es/3 -d '{"a":"0","b":"0","c":"1","d":"3","e":"8","path":"zzz","classify":"b"}'  
  5. curl -XPUT http://127.0.0.1:9200/blog/es/4 -d '{"a":"4","b":"3","c":"6","d":"1","e":"4","path":"eee","classify":"a"}'  
  6. curl -XPUT http://127.0.0.1:9200/blog/es/5 -d '{"a":"1","b":"7","c":"5","d":"3","e":"1","path":"fff","classify":"b"}'  
  7. curl -XPUT http://127.0.0.1:9200/blog/es/6 -d '{"a":"4","b":"0","c":"4","d":"9","e":"6","path":"ggg","classify":"a"}'  
  8. curl -XPUT http://127.0.0.1:9200/blog/es/7 -d '{"a":"1","b":"3","c":"0","d":"1","e":"3","path":"hhh","classify":"b"}'  
  9. curl -XPUT http://127.0.0.1:9200/blog/es/8 -d '{"a":"4","b":"2","c":"1","d":"0","e":"3","path":"iii","classify":"b"}'  
  10. curl -XPUT http://127.0.0.1:9200/blog/es/9 -d '{"a":"1","b":"1","c":"3","d":"0","e":"9","path":"jjj","classify":"b"}'  
  11. curl -XPUT http://127.0.0.1:9200/blog/es/10 -d '{"a":"1","b":"0","c":"9","d":"9","e":"5","path":"kkk","classify":"a"}'  


这是正确运行的结果:





项目链接:

链接:https://pan.baidu.com/s/1Wi3ywvjCFVOOxUNdP_ND7w 密码:uqn7


下面给出pom.xml文件

[java]  view plain  copy
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  2.   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
  3.   <modelVersion>4.0.0</modelVersion>  
  4.   
  5.   <groupId>com.taste</groupId>  
  6.   <artifactId>elasticsearch-taste</artifactId>  
  7.   <version>0.0.1-SNAPSHOT</version>  
  8.   <packaging>jar</packaging>  
  9.     
  10.   <name>elasticsearch-taste</name>  
  11.   <url>http://maven.apache.org</url>  
  12.   
  13.   <properties>  
  14.     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
  15.     <maven.compiler.source>1.8</maven.compiler.source>  
  16.     <maven.compiler.target>1.8</maven.compiler.target>  
  17.   </properties>  
  18.   
  19.   <dependencies>  
  20.   <!-- https://mvnrepository.com/artifact/nz.ac.waikato.cms.moa/moa -->  
  21. <dependency>  
  22.     <groupId>nz.ac.waikato.cms.moa</groupId>  
  23.     <artifactId>moa</artifactId>  
  24.     <version>2017.06</version>  
  25. </dependency>  
  26.   
  27.           
  28.    <dependency>  
  29.       <groupId>org.carrot2</groupId>  
  30.       <artifactId>carrot2-mini</artifactId>  
  31.       <version>3.15.1</version>  
  32.       <scope>compile</scope>  
  33.       <exclusions>  
  34.         <exclusion>  
  35.           <artifactId>*</artifactId>  
  36.           <groupId>*</groupId>  
  37.         </exclusion>  
  38.       </exclusions>  
  39.     </dependency>  
  40.     <dependency>  
  41.       <groupId>org.simpleframework</groupId>  
  42.       <artifactId>simple-xml</artifactId>  
  43.       <version>2.7.1</version>  
  44.       <scope>compile</scope>  
  45.       <exclusions>  
  46.         <exclusion>  
  47.           <artifactId>*</artifactId>  
  48.           <groupId>*</groupId>  
  49.         </exclusion>  
  50.       </exclusions>  
  51.     </dependency>  
  52.     <dependency>  
  53.       <groupId>com.carrotsearch</groupId>  
  54.       <artifactId>hppc</artifactId>  
  55.       <version>0.7.1</version>  
  56.       <scope>compile</scope>  
  57.       <exclusions>  
  58.         <exclusion>  
  59.           <artifactId>*</artifactId>  
  60.           <groupId>*</groupId>  
  61.         </exclusion>  
  62.       </exclusions>  
  63.     </dependency>  
  64.     <dependency>  
  65.       <groupId>org.carrot2.attributes</groupId>  
  66.       <artifactId>attributes-binder</artifactId>  
  67.       <version>1.3.1</version>  
  68.       <scope>compile</scope>  
  69.       <exclusions>  
  70.         <exclusion>  
  71.           <artifactId>*</artifactId>  
  72.           <groupId>*</groupId>  
  73.         </exclusion>  
  74.       </exclusions>  
  75.     </dependency>  
  76.     <dependency>  
  77.       <groupId>org.carrot2.shaded</groupId>  
  78.       <artifactId>carrot2-guava</artifactId>  
  79.       <version>18.0</version>  
  80.       <scope>compile</scope>  
  81.       <exclusions>  
  82.         <exclusion>  
  83.           <artifactId>*</artifactId>  
  84.           <groupId>*</groupId>  
  85.         </exclusion>  
  86.       </exclusions>  
  87.     </dependency>  
  88.     <dependency>  
  89.       <groupId>commons-lang</groupId>  
  90.       <artifactId>commons-lang</artifactId>  
  91.       <version>2.6</version>  
  92.       <scope>compile</scope>  
  93.       <exclusions>  
  94.         <exclusion>  
  95.           <artifactId>*</artifactId>  
  96.           <groupId>*</groupId>  
  97.         </exclusion>  
  98.       </exclusions>  
  99.     </dependency>  
  100.     <dependency>  
  101.       <groupId>com.fasterxml.jackson.core</groupId>  
  102.       <artifactId>jackson-core</artifactId>  
  103.       <version>2.8.6</version>  
  104.       <scope>compile</scope>  
  105.       <exclusions>  
  106.         <exclusion>  
  107.           <artifactId>*</artifactId>  
  108.           <groupId>*</groupId>  
  109.         </exclusion>  
  110.       </exclusions>  
  111.     </dependency>  
  112.     <dependency>  
  113.       <groupId>com.fasterxml.jackson.core</groupId>  
  114.       <artifactId>jackson-annotations</artifactId>  
  115.       <version>2.8.6</version>  
  116.       <scope>compile</scope>  
  117.       <exclusions>  
  118.         <exclusion>  
  119.           <artifactId>*</artifactId>  
  120.           <groupId>*</groupId>  
  121.         </exclusion>  
  122.       </exclusions>  
  123.     </dependency>  
  124.     <dependency>  
  125.       <groupId>com.fasterxml.jackson.core</groupId>  
  126.       <artifactId>jackson-databind</artifactId>  
  127.       <version>2.8.6</version>  
  128.       <scope>compile</scope>  
  129.       <exclusions>  
  130.         <exclusion>  
  131.           <artifactId>*</artifactId>  
  132.           <groupId>*</groupId>  
  133.         </exclusion>  
  134.       </exclusions>  
  135.     </dependency>  
  136.     <dependency>  
  137.       <groupId>org.slf4j</groupId>  
  138.       <artifactId>slf4j-api</artifactId>  
  139.       <version>1.7.13</version>  
  140.       <scope>compile</scope>  
  141.       <exclusions>  
  142.         <exclusion>  
  143.           <artifactId>*</artifactId>  
  144.           <groupId>*</groupId>  
  145.         </exclusion>  
  146.       </exclusions>  
  147.     </dependency>  
  148.     <dependency>  
  149.       <groupId>org.slf4j</groupId>  
  150.       <artifactId>slf4j-log4j12</artifactId>  
  151.       <version>1.7.13</version>  
  152.       <scope>compile</scope>  
  153.       <exclusions>  
  154.         <exclusion>  
  155.           <artifactId>*</artifactId>  
  156.           <groupId>*</groupId>  
  157.         </exclusion>  
  158.       </exclusions>  
  159.     </dependency>  
  160.     <dependency>  
  161.       <groupId>org.carrot2</groupId>  
  162.       <artifactId>morfologik-stemming</artifactId>  
  163.       <version>2.1.1</version>  
  164.       <scope>compile</scope>  
  165.       <exclusions>  
  166.         <exclusion>  
  167.           <artifactId>*</artifactId>  
  168.           <groupId>*</groupId>  
  169.         </exclusion>  
  170.       </exclusions>  
  171.     </dependency>  
  172.     <dependency>  
  173.       <groupId>org.carrot2</groupId>  
  174.       <artifactId>morfologik-fsa</artifactId>  
  175.       <version>2.1.1</version>  
  176.       <scope>compile</scope>  
  177.       <exclusions>  
  178.         <exclusion>  
  179.           <artifactId>*</artifactId>  
  180.           <groupId>*</groupId>  
  181.         </exclusion>  
  182.       </exclusions>  
  183.     </dependency>  
  184.     <dependency>  
  185.       <groupId>org.elasticsearch</groupId>  
  186.       <artifactId>elasticsearch</artifactId>  
  187.       <version>5.4.1</version>  
  188.       <scope>provided</scope>  
  189.     </dependency>  
  190.     <dependency>  
  191.       <groupId>org.locationtech.spatial4j</groupId>  
  192.       <artifactId>spatial4j</artifactId>  
  193.       <version>0.6</version>  
  194.       <scope>provided</scope>  
  195.       <exclusions>  
  196.         <exclusion>  
  197.           <artifactId>*</artifactId>  
  198.           <groupId>*</groupId>  
  199.         </exclusion>  
  200.       </exclusions>  
  201.     </dependency>  
  202.     <dependency>  
  203.       <groupId>com.vividsolutions</groupId>  
  204.       <artifactId>jts</artifactId>  
  205.       <version>1.13</version>  
  206.       <scope>provided</scope>  
  207.       <exclusions>  
  208.         <exclusion>  
  209.           <artifactId>*</artifactId>  
  210.           <groupId>*</groupId>  
  211.         </exclusion>  
  212.       </exclusions>  
  213.     </dependency>  
  214.     <dependency>  
  215.       <groupId>org.apache.logging.log4j</groupId>  
  216.       <artifactId>log4j-api</artifactId>  
  217.       <version>2.8.2</version>  
  218.       <scope>provided</scope>  
  219.       <exclusions>  
  220.         <exclusion>  
  221.           <artifactId>*</artifactId>  
  222.           <groupId>*</groupId>  
  223.         </exclusion>  
  224.       </exclusions>  
  225.     </dependency>  
  226.     <dependency>  
  227.       <groupId>org.apache.logging.log4j</groupId>  
  228.       <artifactId>log4j-core</artifactId>  
  229.       <version>2.8.2</version>  
  230.       <scope>provided</scope>  
  231.       <exclusions>  
  232.         <exclusion>  
  233.           <artifactId>*</artifactId>  
  234.           <groupId>*</groupId>  
  235.         </exclusion>  
  236.       </exclusions>  
  237.     </dependency>  
  238.     <dependency>  
  239.       <groupId>org.elasticsearch</groupId>  
  240.       <artifactId>jna</artifactId>  
  241.       <version>4.4.0</version>  
  242.       <scope>provided</scope>  
  243.     </dependency>  
  244.     <dependency>  
  245.       <groupId>org.elasticsearch.test</groupId>  
  246.       <artifactId>framework</artifactId>  
  247.       <version>5.4.1</version>  
  248.       <scope>test</scope>  
  249.     </dependency>  
  250.     <dependency>  
  251.       <groupId>org.assertj</groupId>  
  252.       <artifactId>assertj-core</artifactId>  
  253.       <version>2.1.0</version>  
  254.       <scope>test</scope>  
  255.       <exclusions>  
  256.         <exclusion>  
  257.           <artifactId>*</artifactId>  
  258.           <groupId>*</groupId>  
  259.         </exclusion>  
  260.       </exclusions>  
  261.     </dependency>  
  262.     <dependency>  
  263.       <groupId>org.json</groupId>  
  264.       <artifactId>json</artifactId>  
  265.       <version>20140107</version>  
  266.       <scope>test</scope>  
  267.       <exclusions>  
  268.         <exclusion>  
  269.           <artifactId>*</artifactId>  
  270.           <groupId>*</groupId>  
  271.         </exclusion>  
  272.       </exclusions>  
  273.     </dependency>  
  274.     <dependency>  
  275.       <groupId>org.elasticsearch.client</groupId>  
  276.       <artifactId>transport</artifactId>  
  277.       <version>5.4.1</version>  
  278.       <scope>test</scope>  
  279.     </dependency>  
  280.   
  281.       
  282.   </dependencies>  
  283. </project>  

猜你喜欢

转载自blog.csdn.net/hellozhxy/article/details/80678380