gpt4 book ai didi

java - 使用 Gradle 5.4.1 签署 Maven jar 会导致 Could not setknown property 'keyId'

转载 作者:行者123 更新时间:2023-12-02 05:52:02 25 4
gpt4 key购买 nike

我正在尝试生成一个 Maven 签名的 jar,但如果我收到此异常

groovy.lang.MissingPropertyException: Could not set unknown property 'keyId' for object of type org.gradle.plugins.signing.SigningExtension

这是我的 build.gradle

plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}

apply from: 'gradle.properties'

group 'com.foo'
version '1.0.0'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
// dependencies
}


task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allJava
}

task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}



publishing {
publications {
myLibrary(MavenPublication) {
from components.java

artifact sourcesJar
artifact javadocJar
}
}

repositories {
maven {
name = 'myRepo'
url = "file://${buildDir}/repo"
}
}
}

signing.keyId='MY_KEY'
signing.password='MY_SECRET'
signing.secretKeyRingFile=/NOT_TO_PUBLISH/secret-keys.gpg


signing {
sign publishing.publications.myLibrary
}

如果我对签名部分发表评论,一切都会正常,并且我的出版物也会生成。

如有任何帮助,我们将不胜感激

最佳答案

documentation它们不带引号:

signing.keyId=24875D73
signing.password=secret
signing.secretKeyRingFile=/Users/me/.gnupg/secring.gpg

我确信你有,但是你尝试过不加引号吗?

上面的文档还包含设置值的替代方法,您会得到不同的响应吗?

    allprojects {
ext."signing.keyId" = id
ext."signing.secretKeyRingFile" = file
ext."signing.password" = password
}

此外,您是否使用最新版本的 Gradle(因此它可以正确支持该插件)?

关于java - 使用 Gradle 5.4.1 签署 Maven jar 会导致 Could not setknown property 'keyId',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56040913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com