I have two maven repositories one local and one external.
On my local repository, I will publish snapshots and releases. On the external repository, I will publish only releases.
My current code in build.gradle for publishing:
publishing {
...
repositories {
maven { // Local Nexus Repository
...
def releaseRepoUrl = "...//repository/maven-releases/"
def snapshotsRepoUrl = "...//repository/maven-snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releaseRepoUrl
}
maven { // external Nexus Repository (only publish if it is a release)
...
def releaseRepoUrl = "...//repository/maven-releases/"
url = version.endsWith('SNAPSHOT') ? "" : releaseRepoUrl
}
}
}
The problem is that if the url is "" an error occurs what's logical because he can't publish to this url.
How can I skip the publishing on the external repository if it is a SNAPSHOT?
if (!version.endsWith('SNAPSHOT')) {- tim_yates