是否可以将自定义清单添加到 Netbeans 6.7.1 中编译的 Java 库中?
我尝试将 manifest.file=${src.dir}/manifest.mf
添加到 project.properties,但查看 build-impl.xml 我发现 manifest.available
code> 通常伴随着 main.class
条件,所以它让我相信,只有当包有一个主类时,我的清单才会被添加,而我的作为一个库,没有主类。无论我尝试什么,生成的库 jar 只包含自动生成的清单,其中只有 Ant-Version 和 Created-By。
I tried adding manifest.file=${src.dir}/manifest.mf
to project.properties, but looking through the build-impl.xml I see that the manifest.available
is usually accompanied by main.class
condition, so it makes me believe that my manifest would be added only if the package has a main class, which mine, being a library, does not have. No matter what I tried, the resulting library jar contains just the auto-generated manifest with only Ant-Version and Created-By.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终在 build.xml 中添加了一个 Jar 任务,这确实是很好,因为它允许我在清单更新后添加 Sign 任务:
I ended up adding a Jar task in the build.xml, which was really good since it allowed me to add a Sign task also after the manifest update:
为了获得易于编辑的 MANIFEST.MF,对上述内容的修改是覆盖 build.xml 中的“-post-jar”任务,例如:
并创建包“META-INF”(也可用于其他调整,例如一个“mime.types”文件),其中有一个名为“MANIFEST.MF”的空文件,然后可以在 NetBeans 编辑器中对其进行编辑,例如包含:
这种方式测试时使用:
产品版本:NetBeans IDE 6.9.1(内部版本 201011082200)
爪哇:1.6.0_21; Java HotSpot(TM) 64 位服务器 VM 17.0-b16
系统:运行在amd64上的Linux版本2.6.32-29-generic; UTF-8; de_DE (nb)
To get an easy to edit MANIFEST.MF a modification of the above is to override the "-post-jar" task in build.xml like:
and to create the package "META-INF" (may also be used for other adjustments like a "mime.types" file) and therein an empty file named "MANIFEST.MF", which then can be edited inside the NetBeans editor, for example containing:
This way tested with:
Product Version: NetBeans IDE 6.9.1 (Build 201011082200)
Java: 1.6.0_21; Java HotSpot(TM) 64-Bit Server VM 17.0-b16
System: Linux version 2.6.32-29-generic running on amd64; UTF-8; de_DE (nb)