org.apache.http不存在解决办法

今天对接接口,调试给的demo,发现好多包找不到:

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;

全都是在org.apache.http下的jar包,因为项目用的是maven,所以去maven repository下载对应的jar包,居然找不到这个jar包,原来这个jar包是过时的类,这些类存在其他的jar包。因此pom.xml引入下面依赖:

 
            org.apache.httpcomponents
            httpclient
            4.5.2
        

        
            org.apache.httpcomponents
            httpcore
            4.4.5
        

报错完美解决!

你可能感兴趣的:(java厚积薄发系列)