Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Dynamic Servlet Registration

Sorry for the previous message.
It was sent from nabble and code fragments were lost in transit.

Here the full message:


Ken Siprell wrote
> ... Unfortunately, the Grails Jetty plugin uses version 7.6.0. 

You can alter this. Use standard Grails features for build dependencies.

1. conf/BuildConfig.groovy. add jetty 8 jars to dependencies closure:

dependencies {
...
        def jettyVersion = "8.1.13.v20130916"
        provided(
          "org.eclipse.jetty:jetty-http:${jettyVersion}",
          "org.eclipse.jetty:jetty-server:${jettyVersion}",
          "org.eclipse.jetty:jetty-webapp:${jettyVersion}",
          "org.eclipse.jetty:jetty-plus:${jettyVersion}",
          "org.eclipse.jetty:jetty-security:${jettyVersion}",
          "org.eclipse.jetty:jetty-websocket:${jettyVersion}",
          "org.eclipse.jetty:jetty-continuation:${jettyVersion}",
          "org.eclipse.jetty:jetty-jndi:${jettyVersion}"
        ) {
            excludes "commons-el","ant",
"sl4j-api","sl4j-simple","jcl104-over-slf4j"
            excludes "xercesImpl","xmlParserAPIs", "servlet-api"
            excludes "mail", "commons-lang"
            excludes([group: "org.eclipse.jetty.orbit", name:
"javax.servlet"],
                     [group: "org.eclipse.jetty.orbit", name:
"javax.activation"],
                     [group: "org.eclipse.jetty.orbit", name:
"javax.mail.glassfish"],
                     [group: "org.eclipse.jetty.orbit", name:
"javax.transaction"])
        }
...
}

2. conf/BuildConfig.groovy. to remove jetty 7 jars added from grails-jetty
plugin, add to plugins closure:

plugins {
...
        // strip jetty7 plugin jars from war
        runtime("org.grails.plugins:jetty:2.0.3"){
            excludes "jetty-http", "jetty-server", "jetty-webapp",
"jetty-plus"
            excludes "jetty-security", "jetty-websocket",
"jetty-continuation", "jetty-jndi"
        }
...
}

3. conf/BuildConfig.groovy. to remove jetty-7 jars from war file, add
grails.war.resources closure:

grails.war.resources = { stagingDir, args ->
    delete(file: "${stagingDir}/WEB-INF/web-jetty.xml")
    delete(file: "${stagingDir}/WEB-INF/jetty-all-7.6.0.v20120127.jar")
}

Also you can add to scripts/_Events.groovy handler for CreateWarStart event:

eventCreateWarStart = { warName, stagingDir ->
    println "Removing Jetty jars"
    Ant.delete {
        fileset(dir:"${stagingDir}/WEB-INF/lib") {
                include(name:"jetty-*.jar")
        }
    }
}


Hope this helps.

-- 
Best regards,
    Igor Poteryaev




--
View this message in context: http://jetty.4.x6.nabble.com/jetty-users-Dynamic-Servlet-Registration-tp4961419p4961436.html
Sent from the Jetty User mailing list archive at Nabble.com.


Back to the top