生成使用Ant源$ C ​​$ C罐 [英] generate jars with source code using Ant

查看:112
本文介绍了生成使用Ant源$ C ​​$ C罐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用蚂蚁在Eclipse中创建.jar文件。

I use ant for creating .jar files in Eclipse.

我需要生成的jar为我的项目也包含源$ C ​​$ C与类文件一起。我们怎么做呢?

I need to generate jar for my project which also contains source code along with the class file. How do we do it?

另一个问题:什么是调试罐子以及如何使用它创建蚂蚁? (在什么地方听说过,并试图涉及他们俩)

Another question: what is a debug jar and how to create it using ant? (have heard about it somewhere and trying to relate them both)

推荐答案

我会修改你的jar任务包含多个文件集;一个用于类,一个用于源文件

I would modify your jar task to include multiple filesets; one for the classes and one for the source files.

<jar destfile="${target.dir}/my-app.jar">
    <fileset dir="${target.dir}/classes" />
    <fileset dir="${src.dir}" includes="**/*.java"/>
</jar>

包装应视为从编译一个单独的关注。这会给你更多的灵活性。例如,您可能希望其他文件集添加到罐子(例如属性文件),或者你可能要打包你的源代码的jar文件是从你的类文件是分开的。

Packaging should be treated as a separate concern from compiling. This will give you more flexibility. For example, you may want to add other filesets to the jar (e.g. properties files), or you may want to package your sources in a jar file that is separate from your class files.

这篇关于生成使用Ant源$ C ​​$ C罐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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