首页 > 解决方案 > 获取 maven 构建错误:javax.crypto.BadPaddingException:给定最终块在 ~/.m2/settings-security.xml 中未正确填充

问题描述

根据文档,我在 ~/.m2/settings-security.xml 文件中创建/添加了以下代码:

<settingsSecurity>
    <master>{ENCRIPTED_PASSWORD}</master>
</settingsSecurity>

使用 maven build(mvn clean package) 后,出现以下错误:

[ERROR] error using security dispatcher: org.sonatype.plexus.components.cipher.PlexusCipherException: javax.crypto.BadPaddingException: Given final block not properly padded
org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: org.sonatype.plexus.components.cipher.PlexusCipherException: javax.crypto.BadPaddingException: Given final block not properly padded


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.4:sign (sign) on project com.daimler.duke.common.server: error using security dispatcher: org.sonatype.plexus.components.cipher.PlexusCipherException: javax.crypto.BadPaddingException: Given final block not properly padded -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] 

http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

任何请求都可以帮助我,我现在是 maven 的新手。

谢谢

标签: javamaven

解决方案


最好重新生成密码。编辑生成的密码可能会损坏它。

下面是生成它的示例命令。请注意在使用 mvn 命令生成密码时在密码周围使用引号。

mvn -emp "<PASSWORD>" and mvn -ep "<PASSWORD>"

推荐阅读