Hi Dean,
Gradle uses configuration by convention. this means you can use project
structure, but you're not forced to. let's start step by step.

To tell gradle you want to build a war you should start your build file
with:
---------------
apply plugin:"war"    
---------------
see
http://gradle.org/0.9-rc-1/docs/userguide/userguide_single.html#web_project_tutorial
Now you can run on this one liner gradle script different gradle tasks
(use gradle -t to get an overview). E.g. "gradle war" creates a war file.
I assume you havn't your source code located under src/main/java? let's
assume you have all your sources located in a "src" folder. you have to
tell gradle about this non default location of your sources by adding
the following two lines:

---------------
sourceSets.main.java.srcDirs = ['src']
sourceSets.main.resources.srcDirs = ['src']
---------------
this means that your java source code is located in 'src' and your
resource files (*.properties, etc.) too.
see
http://gradle.org/0.9-rc-1/docs/userguide/userguide_single.html#N11B7A
for further informations about customizing your project layout.

the war plugin looks for your webapp files in  src/main/webapp. to
change this you can add:
----------------
webAppDirName = "webapp"
----------------
"webapp" is the name of your webapp folder. see
http://gradle.org/0.9-rc-1/docs/userguide/userguide_single.html#N1299C

now if you run "gradle war" most likely you get lots of compile errors
since gradle has no clue where your third party libs are located.

where do you store your thirdparty libs? in a "lib" folder? use the
following lines to add this folder to your gradle build file:

---------------
repositories {
    flatDir name: 'localRepository', dirs: 'lib'
}
---------------
see
http://gradle.org/0.9-rc-1/docs/userguide/userguide_single.html#N10688
for details.

now you must add your dependencies like this:

---------------
repositories {
    compile name: 'struts2-core'
    runtime name: 'spring-core'
    ...
}
---------------

see
http://gradle.org/0.9-rc-1/docs/userguide/userguide_single.html#dependency_management
for further details

after adding all your dependencies. gradle war should work for you. have
fun.

regards,
René

------------------------------------
Rene Groeschke

[email protected]
http://www.breskeby.com
http://twitter.com/breskeby
------------------------------------


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

    http://xircles.codehaus.org/manage_email


Reply via email to