On 31/12/2010, at 11:37 AM, StormeHawke wrote:
>
> Pardon the repost, the formatting of the original message got stripped out
> and left it all but unreadable
>
> Ok, so I found the solution to this once and had it working, but then I
> broke it while working on something else and for the life of me I can't find
> the page again where I found the solution. I wish I could remember what
> search terms I used the first time...
>
> Anyway, In my webapp dir, I've got WEB-INF/datasource. Inside that
> directory are a few files that, depending on the system property invoked
> from the command line, one of them gets copied to
> WEB-INF/dpu-datasource.xml. The datasource dir needs to be excluded from
> the war. (the copy task works)
>
> war {
> copy {
> from('WebRoot/WEB-INF/datasource/')
> into('WebRoot/WEB-INF/')
> include(datasource + '.xml')
> rename(datasource + '.xml', 'dpu-datasource.xml')
> }
> excludes ['WebRoot/WEB-INF/datasource/*.*']
> baseName = 'dpu2'
> }
>
> The "excludes" section there has absolutely no effect - the datasource dir
> and the sensitive files contained therein are still being included in the
> war. What am I missing here?
You're running into a combination of (arguably) inconsistent Gradle API and
some Groovy behaviour. War.excludes is a property, not a method, so Groovy
interprets your code as:
getExcludes().getAt('WebRoot...')
which does nothing (it will simply return null)
You want this:
excludes = [...]
or
exclude 'WebRoot...'
Before Gradle 1.0 is released, we'd like to go over the API and smooth out
problems like this. We might, for example, add an excludes(List<String>) method
for cases like this.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz