Ok, I am the build master for some builds here. The build system has to be usable by release manager and developer. Both groups should not be bothered about build details and should not be able to do serious errors. So I have to write a build script with the following requirements:
- using the build should not require setting system properties or something. usage of “gradle taskname” should be sufficient * I want to publish snapshots to a snapshot repository (ivy or maven compatible) * I want to publish releases to a release repository (maven compatible, because it’s used from outside our project) * snapshots should have versions with a timestamp like 3.5.0-20131211.120012 * releases should have clean versions without timestamp like 3.5.0
Is it possible to make the version of a publication dynamically using some Groovy magic? It looks like, the version of a publishing->publications->MavenPublication is defined during the configuration phase. By the time the gradle script knows, if it is a snapshot or a release build, the version number of the pom is already defined.
Can I use some closures magic to delay the calculating of the version number or can I modify the version number of the MavenPublication somehow? Because of my requirements above I don’t want to force the user to use command line tricks like defining the repository or version via system property or similar stuff. This is too error prone and unconvenient.
Any help will be appreciated,