简体   繁体   English

使用ant为项目中的特定文件创建Jar

[英]Create Jar for a specific file in a project using ant

I compiled all the java files using ant and stored the class files in a folder. 我使用ant编译了所有Java文件,并将类文件存储在一个文件夹中。
I want to make jar for a specific class file form the output folder(compiled). 我想从输出文件夹(编译)中为特定类文件制作jar。
How can i done this. 我该怎么做。
NOTE:The class file depends another classes in the project 注意:该类文件取决于项目中的其他类

Use the ant Jar Task with a nested fileset that specifies only the file(s) you wish to include in the jar file. ant Jar Task与嵌套文件集一起使用 ,该文件仅指定您希望包含在jar文件中的文件。

Something like: 就像是:

<jar jarfile="pinky.jar">
  <fileset dir="build/classes" >
    <include name="com/example/Brain.class" />
  </fileset>
</jar>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM