maven - 无法使用 Gradle 插件在 Jenkins 中获取类型为 DefaultGroovyMavenDeployer 的对象的未知属性
问题描述
我正在尝试在 Jenkins 中执行 gradle 构建脚本。这个脚本有一个这样的任务部分:
uploadArchives {
repositories {
mavenDeployer {
repository(url: 'https://mynexus.com/repository/maven-releases/') {
authentication(userName: nexusReleaseUser, password: nexusReleasePassword)
}
snapshotRepository(url: 'https://mynexus.com/repository/maven-snapshots/') {
authentication(userName:nexusSnapshotsUser, password:nexusSnapshotsPassword)}
}
}
}
其中 nexusReleaseUser、nexusReleasePassword、nexusSnapshotsUser 和 nexusSnapshotsPassword 是 gradle.properties 中定义的属性。
该脚本在我的本地机器上完美运行,但在 Jenkins 中失败。
* What went wrong:
A problem occurred evaluating project ':XXXXXXX'.
> Could not get unknown property 'nexusReleaseUser' for object of type
org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer.
我将这些属性添加到 Jenkins Gradle 插件配置中,在 jenkins 控制台中我可以看到它们已定义:
gradle -PnexusSnapshotsPassword=XXXXX -PnexusSnapshotsUser=XXXX -PnexusReleaseUser=XXXX -PnexusReleasePassword=XXXX clean buildAll -b build.gradle
即使一个放一个:
println nexusReleaseUser
完美地工作并打印分配给属性的值......但是当在 maven deployer 的身份验证部分使用属性时根本不工作
你能帮助我吗?
解决方案
推荐阅读
- c++ - 哪个版本的 Google protobuf 使用 -std=c++98 或 -std=c++03 构建?
- javascript - 如何将此 AngularJS HTML 模板添加到我的 Angular 8 项目中
- regex - ansible regex_search 从 stdout_lines 中排除特定字符串
- mysql - MySQL 连接使用 poolConnection 关闭
- javascript - javascript 正则表达式不匹配少于 3 个字符的问题
- python-3.x - 创建一个在计时器达到 0 时“解锁”的系统
- php - 在迁移脚本中为 hstore 使用 `Bosnadev\Database\Schema\Blueprint` 而不是 ` Illuminate\Database\Schema\Blueprint`
- spring-boot - 使用 Angular 7 和 spring boot 登录
- javascript - 对象字符串数组转换为仅对象数组javascript
- rest - 如何在 Google Translate API v2 中使用 API 密钥发出基本的 HTTP 请求?