如何使用Gradle从档案中删除文件 [英] How Do I Remove A File From An Archive Using Gradle
问题描述
在Unix中,我可以执行以下操作从我的jar中删除一个文件
zip -d myfile.jar META-INF /SIGN.RSA
在Gradle / Groovy中有一种简单的方法吗?
我不想将整个文件解压并重新压缩,因为我有一些非常大的罐子。
可能可以告诉我在用我自己的方式重新签署之前,我会取消签署一些罐子。如果您有解决方案(并且不需要拆包和重新打包),我也会接受您的答案。 解决方案
根据我的知识,这种特定情况没有内置任务。
但是,您可以轻松地使用例如:
exec {
可执行文件jar.exe
args -d,myfile.jar,META-INF / SIGN.RSA
}
In Unix I can do the following to delete a file from my jar
zip -d myfile.jar META-INF/SIGN.RSA
Is there a simple way to do it in Gradle/Groovy?
I don't want to unzip and re-zip the whole file as I have some very large jars.
As you can probably tell I am un-signing some jars before re-signing them with my own. If you have a solution for that (and doesn't require unpacking and repacking) I'll accept your answer too.
Per my knowledge there's no built-in task for this specific case. However, you can easily do it by using exec, e.g.:
exec {
executable "jar.exe"
args "-d", "myfile.jar", "META-INF/SIGN.RSA"
}
这篇关于如何使用Gradle从档案中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!