jarsigner无法执行目标

时间:2014-12-03 15:24:14

标签: java eclipse maven jar jarsigner

我在maven中使用maven-jarsigner-plugin来签署多个罐子,但是它很糟糕。

从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

4 个答案:

答案 0 :(得分:3)

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

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

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

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

所有Codebase条目都应该在一行上。错误的格式化是由于日食源 - &gt;格式工具。当我上次清理源格式时,Eclipse在<Codebase></Codebase>之间放置了不需要的换行符和标签。一旦移除了这个不需要的空白区域,就可以根据需要完成maven构建。

答案 1 :(得分:1)

我有同样的问题。我修复了仅添加文件(testkeys.store

的扩展名
  <alias>stathis</alias>
  <keystore>${project.basedir}\testkeys.store</keystore>
  <storepass>123456</storepass>
  <keypass>123456</keypass>

答案 2 :(得分:0)

我有这个问题。我的问题是我输入了密钥库名称。修复拼写错误修复了整个问题。我还必须在密钥库中包含扩展名。

答案 3 :(得分:0)

希望这对某人有用,我遇到了类似的问题。

在我的 pom.xml 中,我有一个名为 maven-assembly-plugin 的插件,结果由于某种原因该插件需要在 maven-jarsigner-plugin 插件之后。但改变后就像一个魅力。

使用此 link 作为参考。