每个类都有罐中的文件中的两个类文件 [英] Each class has two classfiles in jar file
问题描述
我也有按Java文件中的两个类文件的jar文件。
I have a jar file which has two class files per java file.
Java的:
Foo.java
Bar.java
类文件:
Foo.class
Foo.class
Bar.class
Bar.class
我已经验证了,只有一个每个类的java文件。 Java文件不包含任何内部类。
我使用的是蚂蚁的jar任务来创建jar文件。在我执行任务,没有在build目录每班只有一个类文件。
I have verified that there is only one java files per class. The java files do not any contain inner classes. I am using the ant jar-task to create the jar file. Before I execute the task, there is only one class file per class in the build directory.
我看到双类文件与罐子-tf jarfile.jar或当我在一个zip程序查看。当我解压文件,压缩程序询问是否应该覆盖现有文件。
I see the double class files with jar -tf jarfile.jar or when I view it in a zip program. When I unpack the files, the zip program asks if it should overwrite the existing file.
怎么能这样呢?
推荐答案
我想我找到了问题。这是jar任务:
I think I found the problem. This is the jar task:
<jar basedir="${build.class.dir}" jarfile="${dist.dir}/${subproject}.jar">
<fileset dir="${build.class.dir}" />
</jar>
我在蚂蚁网站阅读
As I read in the Ant website
这个任务形成的隐文件集,并支持大多数属性(DIR成为> BASEDIR),以及嵌套的,和元素。
This task forms an implicit FileSet and supports most attributes of (dir becomes >basedir) as well as the nested , and elements.
所以它似乎,无论是标签或BASEDIR是uneccessary。至少,如果我注释掉文件集的tag works.fine。
So it would seem that either the tag or basedir is uneccessary. At least it works.fine if I comment out the fileset tag.
感谢您的帮助和指点一下!
Thanks for your help and pointers!
这篇关于每个类都有罐中的文件中的两个类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!