3

Related to How do I add a .properties file into my WAR using gradle? but not quite:

I've got one project, call it 'webclient' that produces:

build/out/WEB-INF/deploy/foo
build/out/client/bar.js
build/out/clientDebug/baz.js

and then I've got a war project, call it 'server' that I'm trying to include the above into the a few different directories by doing:

war {
    from files(project(':webclient').file('build/out/WEB-INF')) {
        into('xxx')
    }
    from files(project(':webclient').file('build/out/client')) {
        into('yyy')
    }
    from files(project(':webclient').file('build/out/clientDebug')) {
        into('zzz')
    }
}

...but that doesn't work. I end up with all the contents under zzz/ ! Am I doing something wrong? bug in gradle (1.0-m6, btw)?

Community
  • 1
  • 1
pjz
  • 41,842
  • 6
  • 48
  • 60

1 Answers1

5

I didn't digged deeper in the details, but the files() method seems to cause the problems here. The following workaround should do the trick for you:

war{     
    from (project(':shared').file('build/out/WEB-INF')) {    
        into('xxx')
    }
    from (project(':shared').file('build/out/client')) {
        into('yyy')
    }
    from (project(':shared').file('build/out/clientDebug')) {
        into('zzz')
    }
}
zellus
  • 9,617
  • 5
  • 39
  • 56
Rene Groeschke
  • 27,999
  • 10
  • 69
  • 78
  • Yes, and thanks! And note that the parenthesis around the arg to 'from' matter, for some reason. Clearly my understanding of groovy is lacking. – pjz Dec 08 '11 at 15:48