java实现爬虫常用的第三方包:

  • httpclient,for http
  • jsoup,for dom
  • rhino,for js
  • jackson,for json

pom.xml摘录

    <dependencies>

        <!-- simulate web browser -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.7</version>
</dependency> <!-- parse DOM -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency> <!-- jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency> <!-- parse javascript -->
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.10</version>
</dependency> <!-- simulate client action -->
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.33</version>
</dependency> <!-- upgrade junit to junit4 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12<!-- default is v3.8.1 --></version>
<scope>test</scope>
</dependency> <!-- log -->
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<!-- <scope>test</scope> -->
</dependency> </dependencies>

启用log4j基本配置,在main方法中加入语句:

public static void main(String[] args) {

    //启用log4j基本配置
//不想去写配置文件,可以用Java基本配置
BasicConfigurator.configure();
//...
}

Java爬虫——常用的maven依赖的更多相关文章

  1. 常用的Maven依赖

    一.数据库类型 1.mysql驱动 <!-- mysql驱动支持 --> <dependency> <groupId>mysql</groupId> & ...

  2. 关于eclipse的maven项目Java Build Path中maven依赖报错问题

    场景描述: respository仓库位置变动过,代码注解等报错 解决方法: 选中项目,点击maven ->update Project即可.

  3. Java开发小技巧(二):自定义Maven依赖

    前言 我们在项目开发中经常会将一些通用的类.方法等内容进行打包,打造成我们自己的开发工具包,作为各个项目的依赖来使用. 一般的做法是将项目导出成Jar包,然后在其它项目中将其导入,看起来很轻松,但是存 ...

  4. java之常用的依赖文件pom.xml

    <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://mave ...

  5. springBoot项目常用maven依赖以及依赖说明

    springBoot项目常用maven依赖以及依赖说明 1:maven-compiler-plugin <build> <plugins> <!-- 指定maven编译的 ...

  6. 封装jar问题java.lang.SecurityException: Invalid signature file digest for Manifest main attributes以及maven依赖重提解决

    1.jar包封装完成后,其他项目引用jar,启动时报错java.lang.SecurityException: Invalid signature file digest for Manifest m ...

  7. Java:Maven依赖包下载

    Maven依赖的包可以到Maven的中心仓库 http://search.maven.org/#browse 进行查找下载 例如需要MyBatis的依赖包,搜索mybatis,然后选择正确的路径,复制 ...

  8. java——maven依赖版本冲突

    博客:maven依赖jar包时版本冲突的解决

  9. Java爬虫利器HTML解析工具-Jsoup

    Jsoup简介 Java爬虫解析HTML文档的工具有:htmlparser, Jsoup.本文将会详细介绍Jsoup的使用方法,10分钟搞定Java爬虫HTML解析. Jsoup可以直接解析某个URL ...

随机推荐

  1. jumpserver堡垒机部署

    初稿(后面我有时间再整理一下,看能不能弄成自动化脚本安装): systemctl stop firewalld #关闭防火墙setenforce 0 #关闭selinuxyum install htt ...

  2. Flagr 架构

    来自官方文档 https://checkr.github.io/flagr/#/flagr_overview There are three components in the flagr, Flag ...

  3. 左耳听风-ARTS-第2周(2019/3/31-2019/4/6)

    Algorithm 验证括号题(https://leetcode.com/problems/valid-parentheses/).这道题在极客时间上覃超的<算法面试通关40讲>(http ...

  4. JIT(Just in time,即时编译,边运行边编译)、AOT(Ahead Of Time,运行前编译),是两种程序的编译方式

    JIT(Just in time,即时编译,边运行边编译).AOT(Ahead Of Time,运行前编译),是两种程序的编译方式

  5. [转载]使用QTP测试Windows对象

    Desktop对象的使用: 通过Desktop对象,可以访问Windows的桌面顶层对象.Desktop对象包括CaptureBitmap.ChildObjects.RunAnalog方法. (1)  ...

  6. Dubbo 入门学习笔记

    项目结构 模块介绍: DubboAPI    ----API接口 DubboConsumer ----消费者 DubboProvider ----生产者 DubboAPI  Service 提供的接口 ...

  7. api签名认证方案

    微信签名算法 token (自己后台配置) nonce:随机数 signature:签名 echostr:返回字符串 https://mp.weixin.qq.com/wiki?t=resource/ ...

  8. python 多线程threading的学习一

    1. import threading #引入线程模块 2 申明实例 t = threading.Thread(target  = fun, args = (,)) 说明:参数target 是要运行的 ...

  9. Linux 学习目录

    1 VIM 快捷键

  10. DOM事件类

    1.DOM中的事件级别 DOM0: element.onclick = function(){} DOM1: 没有与事件相关的设计 DOM2: element.addEventListener('cl ...