---
title: "heritrix 3.2.0  -- 环境搭建 "
author: "xiamizy"
date: "2014-07-11T10:02:23Z"
tags: ["Java", "heritrix", "爬虫"]
categories: ["开源软件"]
slug: "heritrix-3-2-0"
draft: false
lastmod: "2014-07-11T10:02:22Z"
id: 2090559
url: "https://mitchz.iteye.com/blog/2090559"
---

heritrix作为一个比较经典的开源爬虫，写这篇文章目的是因为，3.X之后的heritrix的介绍以及配置的文章比较少了。

heritrix 3.x 以后使用maven 2配置jar包引用，但是总是有好多包没法从maven库下载。所以，这里讲的环境搭建直接使用了编译好的工程来做，heritrix-3.2.0-dist.tar.gz以及源码压缩包heritrix-3.2.0-src.tar.gz

 

具体方法如下：

新建java工程（非maven）

![](http://dl2.iteye.com/upload/attachment/0098/9960/66248c5e-1380-3241-abeb-7d6cb0e13524.png)

将heritrix-3.2.0-dist.tar.gz解压放到工程目录  
![](http://dl2.iteye.com/upload/attachment/0098/9963/ecb8af3c-0600-3901-bd25-43a9df4e6d31.png)

添加源代码引用，使用heritrix-3.2.0-src.zip：

![](http://dl2.iteye.com/upload/attachment/0098/9965/cf8dc810-a639-38b0-bec6-c7c3a898afd5.png)  
 

 尝试启动heritrix，heritrix内核使用jetty所以不需要依附tomcat或者其他web容器。

入口类是这个org.archive.crawler.Heritrix

![](http://dl2.iteye.com/upload/attachment/0098/9969/2f99adf1-c483-329f-a5df-4b042de8999e.png)  
   
   
![](http://dl2.iteye.com/upload/attachment/0098/9971/7c3fa453-b9b4-35ff-85cc-53e145b2a2f5.png)  
 启动成功：

```
Oracle Corporation Java(TM) SE Runtime Environment 1.7.0_55-b13
Using ad-hoc HTTPS certificate with fingerprint...
SHA1:7C:99:FC:BC:62:13:DD:F3:B8:24:2F:EF:B7:60:0E:E2:AF:A1:13:8E
Verify in browser before accepting exception.
2014-07-11 01:54:31.408 警告 thread-1 org.archive.crawler.framework.Engine.findJobConfigs() invalid job directory: .\jobs\.gitignore where job expected from: .\jobs\.gitignore
2014-07-11 01:54:31.550:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2014-07-11 01:54:31.552:INFO::jetty-6.1.26
2014-07-11 01:54:31.753:INFO::Started SslSocketConnector@localhost:9095
engine listening at port 9095
operator login set per command-line
NOTE: We recommend a longer, stronger password, especially if your web 
interface will be internet-accessible.
Heritrix version: 3.2.0
```

请求： https://localhost:9095/

![](http://dl2.iteye.com/upload/attachment/0098/9973/11128b65-b568-3558-8d55-3e0a84df9388.png)  
 现在可以正常使用了。

#### heritrix 3.2.0 dist 包下载见[*http://mitchz.iteye.com/blog/2088134*](/blog/2088134)