On 01/02/2011, at 10:40 AM, Matt Stine wrote:
> This doesn't have the intended effect either. In fact, it pretty much blows
> away the entire classpath.
>
> Taking a look at the source code for War sheds some light:
>
> webInf.into('classes') {
> from {
> def classpath = getClasspath()
> classpath ? classpath.filter {File file -> file.isDirectory()} : []
> }
> }
>
> It looks like this pulls in the contents of *anything* that is a directory,
> but without filtering the contents of that directory in any way. I may be
> wrong, being new at Gradle and all, but it looks as if I would need to
> completely override this behavior in favor of something that works at a more
> granular level.
At the moment, that's pretty much the case. You could do something like this:
war {
// remove classes from the classpath
classpath = configurations.runtime
// add them in explicitly, with the filtering applied
webInf {
into('classes') {
from sourceSets.main.classes
exclude '...'
}
}
}
Of course, this should be much simpler to achieve. For example, we might add
something like this:
war {
classpath {
exclude '...'
}
}
Could you add a jira issue for this problem?
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz