Hello!
I searched around quite a while on this issue but did not find a clear solution to my problem. Also I am not quite sure whether it is a gradle behaviour or a “problem” of the plugin (at.bxm.svntools).
Problem is:
I have a multi module project with subprojects creating jars or wars. For the war projects I wanted to extend information in the manifest basically with the same information. My first version of the setup used a duplicated configuration for the manifest attributes in all war projects. I wanted to clean that up a bit by defining a global task configuration.
So this is my project layout
root
build.gradle
settings.gradle
-- jarProject
build.gradle
-- warProject1
build.gradle
-- warProject2
build.gradle
In the root project I have defined plugins and a configuration for war tasks to set manifest attributes. Those attributes are basically the same for all war projects.
plugins {
id 'at.bxm.svntools' version '3.1' apply true
}
subprojects {
tasks.withType(War).configureEach {
manifest {
attributes(
'Implementation-Version': project.version
'SVN-Revision': "$svntools.info.revisionNumber"
...
)
}
}
}
In the subprojects - e.g. warProject1 - I configure the war task to set the archiveFileName and add some additional project specific manifest attributes
war {
archiveFileName = 'warProject1.war'
manifest {
attributes(
'ProjectSpecific': 'someSpecificInfo'
)
}
}
So far everything works as expected. But there is the problem with $svntools which basically is the same in all subprojects so I wanted to set it only once in the root project with the plugin also only used in root.
But while project.version is giving the correct information for the particular subproject, the SVN-Revision is always providing the information from the root project - so the value of SVN-Revision is the root projects revision in all war projects.
Somehow in contrast to project the $svntools property is locally scoped or so.
Right now I would have to go with the same approach as with ProjectSpecific attribute in manifest but this would mean to basically use plugin and duplicate attribute in all war projects build file.
Is there a way that I can use $svntools in root but that it is executed within the scope of the particular project?
Thx!
Rob