清洁的方式将多个罐子结合? pferably使用Ant $ P $ [英] Clean way to combine multiple jars? Preferably using Ant

查看:106
本文介绍了清洁的方式将多个罐子结合? pferably使用Ant $ P $的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些我想rejar到一个JAR外部罐子运行时依赖。这些外部依赖存储在external_jars目录下,我想能不能全部列出来(即,不是需要改变我的构建脚本,如果我的依赖关系发生变化)。有什么想法?

谷歌给了我如何做一个很好的答案 - 如果你不介意列明每个罐子作为一个依赖:

<一个href=\"http://markmail.org/message/zijbwm46maxzzoo5\">http://markmail.org/message/zijbwm46maxzzoo5

粗略地说,我想沿着以下线的东西,这将结合所有罐子在lib目录到out.jar(有一些理智的覆盖规则)。

 罐子-combine退房手续out.jar -in的lib / *。JAR


解决方案

只需使用 zipgroupfileset 与蚂蚁的Zip任务

 &LT;拉链destfile =out.jar&GT;
    &LT; zipgroupfileset DIR =lib目录包括=*罐子。/&GT;
&LT; /拉链&GT;

这将拼合所有包含的jar库的内容。

I have runtime dependencies on some external jars that I would like to "rejar" into a single jar. These external dependencies are stored in an external_jars directory, and I'd like to be able to not have to list them all (i.e., not to need to change my build scripts if my dependencies change). Any thoughts?

Google gave me a good answer on how to do this - if you don't mind listing out each jar as a dependency:

http://markmail.org/message/zijbwm46maxzzoo5

Roughly, I want something along the lines of the following, which would combine all jars in the lib directory into out.jar (with some sane overwrite rules).

jar -combine -out out.jar -in lib/*.jar

解决方案

Just use zipgroupfileset with the Ant Zip task

<zip destfile="out.jar">
    <zipgroupfileset dir="lib" includes="*.jar"/>
</zip>

This will flatten all included jar libraries' content.

这篇关于清洁的方式将多个罐子结合? pferably使用Ant $ P $的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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