The artifact names are modified according to the build configuration like this
uploadReleaseCandidate {
repositories {
mavenDeployer {
...
if (!version.contains("-RC")) {
pom.version = version + "-RC"
}
...
and similar for -SNAPSHOT and -RELEASE. However, that way all project jars are referencing a “naked” jar name (like org.xyz:A:0.1 rather than org.xyz:A:0.1-RC). So here’s the question:
How do I write my build script so in the generated POM that sub-projects
for configuration “snapshot” reference “-SNAPSHOT.jar” files - for configuration “releaseCandidate” reference “-RC.jar” files - for configuration “release” reference “RELEASE” files ?
Every project creates a single jar file as an artifact (the project structure is a little similar to OSGi, with interfaces etc. going into one jar file and an implementation of that into another).
And how do these Jars reference other Jar names (“all project jars are referencing a “naked” jar name”)? Are you talking about the ‘dependency’ declarations of the generated POMs?
Sorry, you’ll have to explain in more detail what exactly the problem is. From what I can tell, the build script above just changes the version in the published POM. I can’t tell if/why you want to have it changed somewhere else.
The jars are uploaded to an artifactory, and to distinguish the stages the artifact names are modified in the mavenDeployer as detailed above, so e.g.
for project A the candidate artifact is renamed to org.xyz:A:0.1-RC for project B the candidate artifact is renamed to org.xyz:B:0.1-RC
The project dependency is specified as given in the first code sample. Now, when I execute my build e.g. for the uploadReleaseCandidate task the artifact gets uploaded as
(no -RC), and that’s not what I want. I would like to have all RC artifacts reference the RC version of their dependencies from this multi-project (and likewise for snapshots and releases).
A simple solution would be to just use a single upload task (‘uploadArchives’) and change ‘project.version’ depending on the value of a system or project property. If you want to keep the separate upload tasks, you’d probably have to reconfigure ‘pom.dependencies’ similar to how you do it for ‘pom.version’.