失败原因是什么:“jarsigner:尝试将 {file} 重命名为 {file}.org 失败”当用 ant 签署 jars 时?
我收到错误:
[signjar] jarsigner:尝试重命名 C:\workspace\line_editor\lib\icon.jar 到 C:\workspace\line_editor\lib\icon.jar.orig 失败
尝试在 Eclipse 内使用 ant 对一组 jar 进行自签名时 。 ant 构建在此项目中运行良好,在其他项目中也运行类似的代码。我对代码做了一些小的更改,并尝试重建并不断收到此错误。
这是相关的 ant 目标:
<target name="sign" depends="jar" description="Signs Jars">
<genkey keystore="myKeystore1" alias="something" storepass="somethingpass"
dname="CN=Classification, OU=NAPA, O=GPC, C=US"/>
<signjar keystore="myKeystore1" alias="something" storepass="somethingpass">
<fileset file="${web.dir}/${jar.name}" />
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</signjar>
</target>
我删除了该项目并再次从我们的存储库中将其拉下来。因此它与其他项目具有相同的默认项目设置,这部分不会失败。我查看了相关的 .jar,它不是只读的。我更改了名称,下一个按字母顺序排列的 .jar 文件也失败了。没有正在运行的程序访问此文件夹中的 .jar。
有什么建议吗?
I am getting the error:
[signjar] jarsigner: attempt to rename
C:\workspace\line_editor\lib\icon.jar
to
C:\workspace\line_editor\lib\icon.jar.orig
failed
when attempting to self sign a set of jars with ant inside Eclipse. The ant build has worked fine in this project and similar code in other projects. I made some small changes to code and tried to rebuild and keep getting this error.
Here is the related ant target:
<target name="sign" depends="jar" description="Signs Jars">
<genkey keystore="myKeystore1" alias="something" storepass="somethingpass"
dname="CN=Classification, OU=NAPA, O=GPC, C=US"/>
<signjar keystore="myKeystore1" alias="something" storepass="somethingpass">
<fileset file="${web.dir}/${jar.name}" />
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</signjar>
</target>
I deleted the project and pulled it down again from our repository. So it has the same default project settings as other projects that this part does not fail. I looked at the .jar in question and it was not read-only. I changed the name and the next alphabetical .jar file also failed. There is no program running that is accessing the .jars in this folder.
Any suggestions as to cause?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一种可能性是该 jar(位于“lib”目录中)位于构建期间使用的类路径中。
${lib.dir}
是否包含在构建文件中使用的类路径中?您可以创建一个单独的目录来存放签名的 jar,并使用 destdir 属性。
One possibility is that the jar - which is in a 'lib' directory - is on a classpath in use during your build. Is
${lib.dir}
included on a classpath used in the buildfile?You could create a separate directory to deposit signed jars to, and specify that to the 'signjar' task using the destdir attribute.
我也有同样的问题。尝试自己重命名 jar 文件。如果无法重命名,您通常可以找出哪个应用程序对其进行了文件锁定。最有可能的是 java 的一些实例。退出所有基于 Java 的应用程序,然后重试。 (使用任务管理器确保您的 java/javaw 没有运行。)之后,它应该可以工作。
I had the same problem. Try renaming the jar file yourself. If it can't be renamed, you can usually figure out which application has a file lock on it. Most likely some instance of java. Quit all java-based apps and try again. (Use task manager to make sure your java/javaw are not running.) After that, it should work.
它在为项目选择的JRE的主目录中查找
jarsigner.exe
。如果 JRE 只是一个 JRE(而不是 JDK),则该程序将不存在。尝试设置特定于项目的 JRE 并确保它实际上是 JDK。
It looks for
jarsigner.exe
in the home directory of the JRE chosen for the project. If the JRE is just a JRE (not a JDK) this program will not be present.Try setting a project-specific JRE and make sure it is actually a JDK.