ANT 中有没有办法从 JAR 中提取一个类文件并将其放入另一个 JAR 中? [英] Is there a way in ANT to extract one class file from a JAR and put it in another JAR?
问题描述
我的 ANT 构建脚本使用名为 createEJBStubs 的 WebSphere 命令生成一个 JAR 文件,其中包含所有内容和一个新生成的类,即:com/myapp/services/_User_Service_Stub.class
.
My ANT build script uses a WebSphere command called createEJBStubs that produces a JAR file with everything plus one new generated class, namely: com/myapp/services/_User_Service_Stub.class
.
由于这个存根类仅用于在开发时运行 JUnit 测试,我希望它位于自己的 JAR 文件中.
Since this stub class is only used for running JUnit tests at dev time, I would like it to be in its own JAR file.
我如何告诉 ANT 复制 AAA.JAR
中匹配的所有内容,例如 _*Stub.class
并仅将这些文件复制到 BBB 中.JAR
(也保持相同的目录/包结构)?
How can I tell ANT to copy everything in AAA.JAR
that matches, say, _*Stub.class
and copy only those files into BBB.JAR
(also, maintaining the same directory/package structure)?
任何想法或指示将不胜感激!谢谢,
Any ideas or pointers would be GREATLY appreciated! Thanks,
罗布
推荐答案
好的——回答我自己的问题——这出奇的简单.抱歉我问了.
Ok -- answering my own question -- that was surprisingly easy. Sorry I asked.
<unzip src="AAA.JAR" dest="./temp">
<patternset>
<include name="**/_*Stub.class" />
</patternset>
</unzip>
<zip destfile="BBB.JAR" basedir="./temp" />
谢谢蚂蚁.
这篇关于ANT 中有没有办法从 JAR 中提取一个类文件并将其放入另一个 JAR 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!