Hi Jerod,

On Jul 7, 2008, at 8:52 PM, JerodLass wrote:


I got it working with the following code:

task(name+'_war').fileSet(dir: new File(projectDir, 'Web Content')){
    include('**/*')
    exclude('WEB-INF/**')
}

task(name+'_war').webInfFileSets = [new FileSet(dir: new File (projectDir,
'Web Content/WEB-INF'), excludes: new LinkedHashSet(['lib/*.jar']))]

It seems a little bizarre but it does what I want, and then I just used ant
to copy over the correct manifest file.

This looks more complicated than necessary. I don't know your exact prerequisites. It looks like you have a folder Web Content which is simply an exploded web archive except the classes dir.

task(name+'_war').fileSet(dir: file(projectDir, "Web Content")) {
        excludes("lib/*.jar")
}

I guess that the Web Content/lib folder contains jars is a legacy issue.

Is there a better way to point
gradle at an existing manifest to use? This is useful for projects that are moving over to gradle when I don't want to rewrite the classpath attribute.

For Gradle's manifest support see user's guide 9.8.4.

- Hans


Jerod



hdockter wrote:

Hi Jerod,

On Jul 4, 2008, at 5:21 PM, Hans Dockter wrote:

I don't understand why this does not work at, as you describe. I
have attached a sample war project (gradlep.zip) which works for me
with 0.2.

It has the layout:

src/main/webapp
src/main/content
src/additionalWebInf

The content of webapp is automatically added to the war. The
content of 'content' is added as a fileset. The content of
additionalWebInf is added as a webinf fileset. Everythings works
except one bug. The web.xml from webapp is not added. This is
strange as we even have an integration test for this. I have filed
a Jira: http://jira.codehaus.org/browse/GRADLE-139

I was fortunately wrong. There is no bug in Gradle but the error lies
in the build script. See below:


But this bug is not a big problem. You can specify the web.xml
directly. Here is the build file.

import org.gradle.api.tasks.util.FileSet

group = 'gradle'
version = '1.0'
usePlugin('war')
targetCompatibility = '1.5'
sourceCompatibility = '1.5'

gradlep_war {
    fileSet(dir: file('src/main/content'))
    webInfFileSets = [new FileSet(dir: new File('src/
additionalWebInf'))]
    webXml = file('src/main/webapp/WEB-INF/web.xml')
}

We overwrite the default webInfFileSet here: The correct version is:

gradlep_war {
     fileSet(dir: file('src/main/content'))
     webInfFileSets = webInfFileSets + [new FileSet(dir: file('src/
additionalWebInf'))]
}

Than everything is fine. Of course this points out that we need a
webInfFileSet method as described above.

If any of your code is not working as expected please send me a test
case for reproducing this.

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





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

    http://xircles.codehaus.org/manage_email





--
View this message in context: http://www.nabble.com/Re%3A-war-woes- tp18258312p18323941.html
Sent from the gradle-user mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email



--
Hans Dockter
Gradle Project lead
http://www.gradle.org





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

   http://xircles.codehaus.org/manage_email


Reply via email to