带Grails App的Crawler4j会抛出错误

时间:2014-06-25 14:16:45

标签: grails groovy crawler4j

对于有经验的人来说,这可能是一个非常基本和愚蠢的问题。但请帮忙。我正在尝试通过跟随this教程在我的Grails应用程序中使用Crawler4j。 我知道它的Java代码,但我在一个名为CrawlerController.groovy的控制器类中使用它。

我添加了jar文件,但是当我写CrawlConfig crawlConfig = new CrawlConfig()时 它抛出了一个编译器错误说" Groovy无法解析类" 。我刷新了依赖关系并尝试了一切。因为我是初学者,可能是我遗失了一些东西。这是我到目前为止所写的内容,并且所有import语句和CrawlConfig语句都会抛出错误:

import edu.uci.ics.crawler4j.crawler.Page;
import edu.uci.ics.crawler4j.crawler.WebCrawler;
import edu.uci.ics.crawler4j.parser.HtmlParseData;
import edu.uci.ics.crawler4j.url.WebURL;
class CrawlerController extends WebCrawler {
    public static void main(String[] args) {
    CrawlConfig crawlConfig = new CrawlConfig()

    }
}

`请帮忙。谢谢。

1 个答案:

答案 0 :(得分:0)

只需刷新您的依赖项。