Groovy @Grab生成java.lang.NoClassDefFoundError [英] Groovy @Grab generating java.lang.NoClassDefFoundError

查看:630
本文介绍了Groovy @Grab生成java.lang.NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让Jsoup和Gaelyk一起开展我的Google App Engine实验项目。在我的日常工作中,我和Grails一起工作,所以想象一下,开始和Gaelyk一起玩是一块蛋糕......并不是那么快......



发生错误当我包括:

  @Grab('org.jsoup:jsoup:1.9.2')

项目构建。但是,访问我正在执行HTML抓取的页面时,出现此错误:


HTTP ERROR 500



访问 /。

的问题

 原因: org / apache / ivy / core / report / ResolveReport 
导致:java.lang.NoClassDefFoundError:org / apache / ivy / core / report / ResolveReport
导致:java.lang.ClassNotFoundException:org。 apache.ivy.core.report.ResolveReport
导致:java.lang.ClassNotFoundExeption:org.apache.ivy.core.report.ResolveReport


更新 build.gradle 文件没有多少好处,我使用Glide来构建项目....任何想法都将得到最多赞赏!

解决方案

正如你所提到的,你正在使用glide,把它放在你的 build.gradle file:

 插件{
idcom .appspot.glide-gaeversion0.9.3
}

依赖项{
compileorg.jsoup:jsoup:1.9.2

在你的Groovlet中,所有你需要的是:

$ p $ import org.jsoup。*

def doc = Jsoup.connect( http://< your-url-here>).get()

重新开始营业



更新:我添加了一个样本 Scraper 滑翔样本

I am attempting to get Jsoup to work on my Google App Engine experiment project with Gaelyk. I work with Grails at my day job, so figured it would be a piece of cake to start playing with Gaelyk... Not so fast...

The error happens when I include:

@Grab('org.jsoup:jsoup:1.9.2')

Project builds. But, accessing the page where I am doing the HTML scraping I get this error:

HTTP ERROR 500

Problem accessing /.

Reason: org/apache/ivy/core/report/ResolveReport
Caused by: java.lang.NoClassDefFoundError:   org/apache/ivy/core/report/ResolveReport 
Caused by: java.lang.ClassNotFoundException: org.apache.ivy.core.report.ResolveReport
Caused by: java.lang.ClassNotFoundExeption:  org.apache.ivy.core.report.ResolveReport

Not having much luck updating the build.gradle file I use with Glide to build the project.... Any ideas would be MOST appreciated!

解决方案

As you mentioned you are using glide, put this in your build.gradle file:

plugins {
    id "com.appspot.glide-gae" version "0.9.3"
}

dependencies {
    compile "org.jsoup:jsoup:1.9.2" 
}

In your Groovlet, all you need is:

import org.jsoup.*

def doc = Jsoup.connect("http://<your-url-here>").get()

And you are back in business

Update: I have added a sample Scraper in glide-samples

这篇关于Groovy @Grab生成java.lang.NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆