简体   繁体   English

ECLIPSE:如何导出最小的jar文件

[英]ECLIPSE: How to export the smallest jar file

My project's jar file size is getting bigger and bigger as more stuff is added into it. 随着项目的添加,我项目的jar文件越来越大。 I am wondering if someone has tips on how to generate a smaller jar file. 我想知道是否有人对如何生成较小的jar文件有提示。

I export it as a Runnable JAR file and the library handling is Copy required libraries into a sub-folder next to the generated JAR. 我将其导出为可运行的JAR文件,库处理为将所需的库复制到生成的JAR旁边的子文件夹中。

In the Properties - Java Compiler - Classfile Generation, everything is unticked. 在“属性-Java编译器-类文件生成”中,所有内容均未选中。

With these options, I was able to save approx 3MB of space. 使用这些选项,我可以节省大约3MB的空间。 And I am hoping I can save more by removing the unneeded data. 我希望通过删除不需要的数据可以节省更多。

My .jar file has a .java._trace files in it. 我的.jar文件中有一个.java._trace文件。 How can I remove this from the jar file? 如何从jar文件中删除它?

A .xtend and .class file is also there for each class. 每个类还存在一个.xtend和.class文件。 Since the .class file is just a conversion of the .xtend, I want to remove either one of these from the jar file. 由于.class文件只是.xtend的转换,因此我想从jar文件中删除其中一个。 How can I achieve this? 我该如何实现?

I would appreciate any tips and tricks that can help me reduce the size of the jar file. 我将不胜感激任何可以帮助我减小jar文件大小的技巧。

If you want to exclude the source code file from the generated JAR file of an Xtext based project (and I think any Eclipse plug-in as well), open the plug-in.xml file which is located in the projects root folder. 如果要从基于Xtext的项目的生成的JAR文件中排除源代码文件(我也认为是任何Eclipse插件),请打开位于项目根文件夹中的plugin-in.xml文件。 Navigate to the tab "Build" and make sure that your source folders are not selected. 导航至“构建”选项卡,并确保未选择您的源文件夹。 Normally there are three source code folders "src", "src-gen" and "xtend-gen". 通常,有三个源代码文件夹“ src”,“ src-gen”和“ xtend-gen”。 Also the "doc" folder which contains generated java doc is not necessary. 同样,包含生成的Java doc的“ doc”文件夹也是不必要的。

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

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