是否有ANT的方式从JAR提取一个类文件,并把它放在另一个JAR? [英] Is there a way in ANT to extract one class file from a JAR and put it in another JAR?

查看:171
本文介绍了是否有ANT的方式从JAR提取一个类文件,并把它放在另一个JAR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Ant构建脚本使用名为createEJBStubs一个WebSphere命令产生的一切JAR文件加上一个新生成的类,分别是: COM / MyApp的/服务/ _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.

由于这个stub类只用于在开发时运行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)?

任何意见或指针将不胜AP preciated!谢谢,

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。

这篇关于是否有ANT的方式从JAR提取一个类文件,并把它放在另一个JAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆