Hey,
I use a custom library conventions plugin to share settings and build logics between all sub projects / libraries of my umbrella project.
As a LAN internal repository I use Apache Archiva and I have different repositories for releases (“internal”) and snapshots (“snapshots”). If “version” ends with “-SNAPSHOT”, I want the project to be published to the snapshots repository, otherwise to the releases repository, and vice versa.
I used the following article to configure my repository:
https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:complete_example
It has the snippet:
publishing {
...
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
...
}
Setting the correct repository https-URLs is no problem. My problem is the “version”-check. It is evaluated to “unspecified”.
Can I access the version string of the project that applies my library conventions?
Or how would you solve the releases/snapshots repo URL selection based on looking for a “-SNAPSHOT” suffix in “version”?
Thank you for any advice!
Yours,
Scully