I would like to add attributes to a jar’s manifest file that are determined by the output of an executed task.
apply plugin: 'java'
task svninfo
{
ext.svnURL = 'placeholder url'
ext.svnLastChangedRev = 'placeholder rev'
doLast {
svnLastChangedRev = 'real rev'
svnURL = 'real url'
println "Latest Changed Revision #:
$svnLastChangedRev"
println "URL: $svnURL"
}
}
jar.dependsOn svninfo
jar {
manifest {
attributes(
'Implementation-Title' : "Jar Test",
'Implementation-Version' : "1",
'Compile-Time'
: new java.util.Date().toString(),
'Compiled-By'
: System.getProperty("user.name"),
'SVN-Revision'
: svninfo.svnLastChangedRev,
'SVN-URL'
: svninfo.svnURL
)}
}
When I run this build, I can clearly see that the svninfo task is run before the jar task and that the properties are updatetd, but the Manifest entries for the svn props are still set to
SVN-Revision: placeholder rev
SVN-URL: placeholder url
What am I missing here?