Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
JAVA_OPTS = -Dhttp.proxyHost=yourproxy -Dhttp.proxyPort=8080

Logging

If you want to see what Grape is doing set the system property "groovy.grape.report.downloads" to "true" (e.g. add "-Dgroovy.grape.report.downloads=true" to JAVA_OPTS) and Grape will print the following infos to System.error:

  • Starting resolve of a dependency
  • Starting download of an artifact
  • Retrying download of an artifact
  • Download size and time for downloaded artifacts

Detail

Grape (The Groovy Adaptable Packaging Engine or Groovy Advanced Packaging Engine) is the infrastructure enabling the grab() calls in Groovy, a set of classes leveraging Ivy to allow for a repository driven module system for Groovy. This allows a developer to write a script with an essentially arbitrary library requirement, and ship just the script. Grape will, at runtime, download as needed and link the named libraries and all dependencies forming a transitive closure when the script is run from existing repositories such as Ibiblio, Codehaus, and java.net.

...

Launching a Jetty server to server serve Groovy templates:

Code Block
import @Grapes([
    @Grab(group='org.mortbayeclipse.jetty.Server
import org.mortbay.jetty.servlet.*
import groovy.servlet.*

@Grab(group = 'org.mortbay.jettyaggregate', module='jetty-server', version='8.1.7.v20120910'),
    @Grab(group='org.eclipse.jetty.aggregate', module = 'jetty-embeddedservlet', version='8.1.7.v20120910'),
    @Grab(group='javax.servlet', module='6.1javax.servlet-api', version='3.0.1')])

import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.*
import groovy.servlet.*

def runServer(duration) {
    def server = new Server(8080)
    def context = new ContextServletContextHandler(server, "/", ContextServletContextHandler.SESSIONS);
    context.resourceBase = "."
    context.addServlet(TemplateServlet, "*.gsp")
    server.start()
    sleep duration
    server.stop()
}

runServer(10000)

...