diff --git a/build.gradle b/build.gradle index f51aeae6179477b0f1d8c0feebe9163b7d4871fe..36770332c8966f574f9fba8b1016b1f0013b976a 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,6 @@ targetCompatibility=1.7 * "Building RELEASE version 0.2.3") */ - ext { isRelease = false } @@ -72,15 +71,32 @@ gradle.taskGraph.whenReady {taskGraph -> if (version.endsWith('-SNAPSHOT')) { println "Building SNAPSHOT version $version" - cargo.deployable { - context = 'testing' - } } else { - isRelease = true; println "Building RELEASE version $version" - cargo.deployable { - context = 'isochrone' - } + isRelease = true; + } + + // fixed lazy versioning for cargo plugin + cargo.deployable { + context = "${isRelease ? 'isochrone' : 'testing'}" + } + + // fixes lazy versioning for maven-publish plugin + project.tasks.withType(PublishToMavenRepository) { publishTask -> + def oldArtifacts = publishTask.publication.artifacts.toArray() + publishTask.publication.artifacts.clear() + oldArtifacts.each({ artifact -> + publishTask.publication.artifacts.artifact( + source: artifact.file.getAbsolutePath().replaceAll(publishTask.publication.version, project.version), + classifier: artifact.classifier, + extension: artifact.extension + ) + }) + publishTask.repository.url repositoryPrefix + "${isRelease ? 'releases' : 'snapshots'}" + publishTask.publication.version = project.version + } + project.tasks.withType(GenerateMavenPom).each { generateMavenPomTask -> + generateMavenPomTask.pom.getProjectIdentity().version = project.version } } @@ -156,7 +172,7 @@ cargo { containerId = cargoContainer port = cargoPort as int - // deployable part is set by versioning above + // deployable block is set by versioning above remote { hostname = cargoHostname @@ -270,7 +286,7 @@ publishing { username repositoryUsername password repositoryPassword } - url repositoryPrefix + "${isRelease ? 'releases' : 'snapshots'}" + // url is configured in versioning part } } }