On 15/02/2011, at 9:19 AM, Rene Groeschke wrote:

> Hi there,
> I've noticed, that when changing the version in my project, The jar task
> isn't executed again since it is marked as up to date. This ends up with
> a jar file in my build/lib directory with up to date content, but with a
> wrong name (project + old version +".jar"). As a workaround I've added
> the following snippet to my build:
> -------
> jar{
>    inputs.properties([version:version])
> }
> -------
> 
> but shouldn't the version be used as input property per default

It is, indirectly. The jar file is treated as an output file, so when it's name 
changes it should be rebuilt. By default, the name includes the version, and 
so, when the version changes, the jar should be rebuilt. This is what I see in 
my test project, and with the build for Gradle.

How are you configuring and running the jar task? Doing anything special or 
unusual there? Does the problem always happen when you change the version?

Perhaps you could print out the contents of jar.outputs.files to check that the 
jar file is included. Using beforeTask { } is probably the most accurate way to 
do this (as this happens just before the up-to-date decision is made):

gradle.taskGraph.beforeTask { task ->
   if (task == jar) {
       task.outputs.files.each { println it }
   }
}


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to