【发布时间】:2020-07-09 13:24:20
【问题描述】:
我有两个 nexus 存储库:一个用于发布,另一个用于快照。我在发布任务中有代码来定义根据文档选择哪个仓库:
repositories {
repositories {
maven {
credentials {
username "$nexusUser"
password "$nexusPassword"
}
def releasesRepoUrl = "https://xxx/repository/factoring-maven-release/"
def snapshotsRepoUrl = "https://xxx/repository/factoring-maven-snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
publications {
create("default", MavenPublication.class) {
from(components["java"])
}
}
}
}
以及此代码包含的子项目:
rootProject.name = 'xxx-integration-lib'
include 'xxx-service1-dto'
include 'xxx-service2-dto'
子项目 build.gradle:
group = "xxx"
version = "0.0.6-SNAPSHOT"
但这不起作用,因为子项目版本始终未指定。 试过了:
- 制作新的 allproject 任务以返回版本
- 使用 project.property('propName') - 但这似乎是一种解决方法,而不是解决方案
有什么想法吗?
【问题讨论】:
标签: java gradle gradle-plugin