gpt4 book ai didi

java - jarsigner 无法执行目标

转载 作者:行者123 更新时间:2023-12-01 00:37:40 24 4
gpt4 key购买 nike

我在 maven 中使用 maven-jarsigner-plugin 对多个 jar 进行签名,但是它失败了。

从 pom.xml 中删除 jarsigner-maven-plugin 将导致项目成功构建。所以它绝对是 jarsigner。

错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.3.2:sign (sign) on project com.company.example: 
Failed executing 'cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_20\jre\..\bin\jarsigner.exe" -keystore ..\com.company.maven\KeyStore -storepass ***** -keypass *****
C:\Project\com.company.example\target\com.company.example-3.2.1-SNAPSHOT.jar Foo"' - exitcode 1 -> [Help 1]

pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<keystore>..\com.company.maven\KeyStore</keystore>
<storepass>abcd123</storepass>
<alias>Foo</alias>
<keypass>abcd123</keypass>
</configuration>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

手动执行命令工作正常。
c:\my_project\com.company.example.maven>C:\Java\jdk1.8.0_20\jre\..\bin\jarsigner.exe -keystore ..\com.company.example.maven\KeyStore -storepass 1234ab -keypa
ss 1234ab C:\my_project\com.company.example.model\target\com.company.example.model-3.2.1-SNAPSHOT.jar Foo
jar signed.

Warning:
The signer certificate has expired.
No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer cert
ificate's expiration date (2014-10-22) or after any future revocation date.

任何帮助将不胜感激。

编辑:问题出现在我的机器上,但不是其他机器,还没有发现问题。

更详细的报告
 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.3.2:sign (sign) on project com.example.project.model: Failed executing 'cmd.
exe /X /C "C:\Java\jdk1.8.0_20\jre\..\bin\jarsigner.exe -keystore ..\com.example.project.maven\KeyStore -storepass ***** -keypass ***** C:\Developer\Ecl
ipseWorkspaces\IDE\com.example.project.model\target\com.example.project.model-3.2.0-SNAPSHOT.jar Foo"' - exitcode 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.3.2:sign (sign) on pr
oject com.example.project.model: Failed executing 'cmd.exe /X /C "C:\Java\jdk1.8.0_20\jre\..\bin\jarsigner.exe -keystore ..\com.example.project.maven\KeyStore
-storepass ***** -keypass ***** C:\Developer\EclipseWorkspaces\IDE\com.example.project.model\target\com.example.project.model-3.2.0-SNAPSHOT.jar Foo"' - exi
tcode 1
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed executing 'cmd.exe /X /C "C:\Java\jdk1.8.0_20\jre\..\bin\jarsigner.exe -keystore ..\
com.example.project.maven\KeyStore -storepass ***** -keypass ***** C:\Developer\EclipseWorkspaces\IDE\com.example.project.model\target\com.example.project.model
-3.2.0-SNAPSHOT.jar foo"' - exitcode 1
at org.apache.maven.plugins.jarsigner.AbstractJarsignerMojo.processArchive(AbstractJarsignerMojo.java:511)
at org.apache.maven.plugins.jarsigner.AbstractJarsignerMojo.processArtifact(AbstractJarsignerMojo.java:427)
at org.apache.maven.plugins.jarsigner.AbstractJarsignerMojo.execute(AbstractJarsignerMojo.java:278)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :com.example.project.model

最佳答案

我解决了Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.3.2:sign (sign)在我的项目中通过修复我正在签名的 jar 中的 list 。

当签名失败时,我的 list CodeBase 条目如下所示。

Codebase: example.com test1.example.com test2.example.com

example.org test1.example.org test2.example.org

所有代码库条目都应该在一行上。错误的格式是由于 Eclipses 源 --> 格式工具。当我上次清理源格式时,Eclipse 在 <Codebase> 之间放置了不需要的换行符和制表符。和 </Codebase> .一旦删除了这个不需要的空白区域,maven 构建就按需要完成了。

关于java - jarsigner 无法执行目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27275401/

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