I am trying to using the maven-publish plugin with gradle 1.8 and snapshot/release repositories.
Inspired by the two posts from: http://forums.gradle.org/gradle/topics/maven_publish_specify_a_repo_as_being_a_snapshot_repo and http://forums.gradle.org/gradle/topics/maven_publish_and_setting_snapshotrepository_and_releaserepository I am using if statements in the publishing part of my buildfile.
Things work great when using a versions defined at the beginning of the build file with an if statement to set the repository-url. When I use version = ‘0.2’ the artifacts get created as “myJar-0.2.jar” and they are published to the release repository correctly. When using version = ‘0.2-SNAPSHOT’ the artifacts get created as "myJar-0.2-SNAPSHOT.jar’ and are published to the snapshot repository.
BUT when I try to change the version in a gradleTask.whenReady statement (like suggested in the docs here: http://www.gradle.org/docs/current/userguide/tutorial_using_tasks.html#configure-by-dag) the artifacts get created correctly as either “myJar-0.2.jar” or "myJar-0.2-SNAPSHOT.jar’, but the publishing task is always searching for “myJar-0.2.jar”.
So when trying to create a SNAPSHOT jar it gets created but can’t be published (since it is not found).
I published my build.gradle file as GitHub Gist here: https://gist.github.com/nikolauskrismer/7306846
Am I missing something here?