我正在GITLAB中设置我的Maven项目的配置项,在发布到Maven Central之前,需要对jar进行签名。 (https://gitlab.com/awe-team/ade)
我用gnuPgp生成密钥对,并将公钥添加到我的gitlab配置文件中。
我是否将我的私钥副本复制到gitlab-ci workfolder?
错误信息是您找不到密钥。
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-gpg-plugin:1.5:sign'
with basic configurator -->
[DEBUG] (f) ascDirectory = /builds/awe-team/ade/target/gpg
[DEBUG] (f) defaultKeyring = true
[DEBUG] (f) interactive = false
[DEBUG] (f) passphrase = *******
[DEBUG] (f) skip = false
[DEBUG] (f) useAgent = true
[DEBUG] (f) project = MavenProject: com.almis.ade:ade:2.0.5 @ /builds/awe- team/ade/pom.xml
[DEBUG] -- end configuration --
[DEBUG] Generating signature for /builds/awe-team/ade/target/ade-2.0.5.pom
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: no default secret key: No secret key
gpg: signing failed: No secret key
我的.gitlab-ci.yaml看起来像这样:
image: maven:latest
variables:
MAVEN_CLI_OPTS: "-X -s .m2/settings.xml --batch-mode -
Dgpg.passphrase=$GPG_PASSPHRASE"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
cache:
paths:
- .m2/repository/
- target/
build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS compile
test:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test
deploy:
stage: deploy
script:
- mvn $MAVEN_CLI_OPTS deploy
only:
- master
我希望构建一个jar版本并签名以发布Maven Central。