【发布时间】:2016-10-26 13:49:48
【问题描述】:
我正在尝试将命令行中的参数传递到 uploadArchives 任务中,以将工件上传到 nexus。问题是 pom groupid 无法正确解析命令行参数。 我正在使用以下命令运行
gradle -Penvironment=dcdev4_106 -Pupload -PuserName=xxx -Ppassword=xxxx uploadArchives
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.archives
repository(url: "http://repo.xxx.net/nexus/content/repositories/maven-internal-snapshot/"){
if (project.hasProperty('upload')) {
authentication(userName: "${userName}", password: "${password}")
}
}
addFilter('artifact1') {artifact, file ->
artifact.name == 'artifact1'
}
addFilter('artifact2') {artifact, file ->
artifact.name == 'artifact2'
}
println "**** Inside uploading archives for ${environment}"
pom('artifact1').version = '1.0-SNAPSHOT'
//pom('artifact1').artifactId = '1.0-SNAPSHOT'
pom('artifact1').groupId = 'com.ngs.dcd.${environment}'
我在这行 pom('artifact1').groupId = 'com.ngs.dcd.${environment}' 收到错误,其中 $environment 参数未得到解析。我还看到它没有抛出任何错误,并且在上面的打印语句中打印良好。问题仅在传递 pom groupid 时出现。不确定参数是否不能传递到 pom 属性中,或者是否有任何特殊语法
谢谢
【问题讨论】:
标签: gradle maven-plugin