2

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!

bdkosher
  • 5,753
  • 2
  • 33
  • 40
Uthaman
  • 25
  • 4
  • 1
    I don't think @Grab is compatible with App Engine as it does some naughty ClassLoader magic. adding the dependency to build.gradle file is the way to go. can you share your build.gradle? – musketyr Aug 04 '16 at 04:54
  • I agree on @Grab. I removed it like the answer below suggested! Thanks! – Uthaman Aug 05 '16 at 00:33

1 Answers1

1

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

kdabir
  • 9,623
  • 3
  • 43
  • 45
  • Thank you! That did the trick. I removed the @Grab and updated build.gradle and it worked! I had stared at this so long it drove me nuts! – Uthaman Aug 05 '16 at 00:33