Quantcast

Gant/Grails/EAR

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Gant/Grails/EAR

Epps, Aaron M.
Has anyone used Gant to build a EAR from a Grails application instead of a WAR?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gant/Grails/EAR

Graeme Rocher-3
Attached is a Gant script that will do it. Took 5 mins to write.

Cheers



On 11 Mar 2010, at 08:10, Epps, Aaron wrote:

> Has anyone used Gant to build a EAR from a Grails application instead of a WAR?
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Ear.groovy (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gant/Grails/EAR

Epps, Aaron M.
You rock, thank you very much!

On Mar 11, 2010, at 3:42 AM, Graeme Rocher wrote:

> Attached is a Gant script that will do it. Took 5 mins to write.
>
> Cheers
>
> <Ear.groovy>
> On 11 Mar 2010, at 08:10, Epps, Aaron wrote:
>
>> Has anyone used Gant to build a EAR from a Grails application instead of a WAR?
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gant/Grails/EAR

felipecao
Case anyone needs to create an EAR containing weblogic-application.xml in order to deploy to weblogic, I've added 2 lines to Graeme's original script (the XML should be under ${basedir}/src/META-INF):


includeTargets << grailsScript("_GrailsWar")

target(ear: "Creates an EAR file from a Grails WAR") {
        war()
        event("StatusUpdate", ["Building EAR file"])
        generateApplicationXml()

        // new line
        def metaInfDir = new File("${basedir}/src/META-INF")

        def warDest = new File(warName).parentFile
        def earFile = "${projectTargetDir}/${contextRoot}.ear"
        ant.ear(destfile:earFile, appxml:appXml, update:true) {
                // new line
                metainf(dir:metaInfDir)

                fileset(dir:warDest, includes:"*.war")
        }
        event("StatusFinal", ["Done creating EAR $earFile"])
}
target(defineContextRoot:"defines the context root") {
        contextRoot = "${grailsAppName}${grailsAppVersion ? '-'+grailsAppVersion : ''}"
}
target(generateApplicationXml:"Generates an application.xml file") {
        depends(defineContextRoot)
        def warDest = new File(warName)
        appXml = "${projectTargetDir}/application.xml"
        new File(appXml).write """\
<?xml version="1.0" encoding="UTF-8"?>
<application
xmlns=http://java.sun.com/xml/ns/j2ee
       xmlns:xsi="http://www.w3.org/ 2001/XMLSchema-instance"
       xsi:schemaLocation="http:// java.sun.com/xml/ns/j2ee
           http://java.sun.com/xml/ns/j2ee/ application_1_4.xsd"
       version="1.4"> 
<display-name>${grailsAppName}</display-name> 

<module> 
    <web> 
        <web-uri>${warDest.name}</web-uri> 
        <context-root>${contextRoot}</context-root> 
    </web> 
 </module> 

</application>       
"""
}

setDefaultTarget(ear)
Loading...