简体   繁体   中英

How to package some classes of a project into a jar?

Currently, I meet a problem. I need to do deserialize in ProjectB, and the serialized object is belongs to ProjectA. It means there hasn't ProjectA jar file in ProjectB. My PM tell me that ProjectA is so large that I can't add ProjectA jar into ProjectB directly. He let me to fetch all the related classes from ProjectA and package them into a new jar. Then we add the new Jar file into ProjectB. But I only know I need two classes but those two classes have many dependencies. So how to export all of them into a jar file? Or do you have any other solutions to solve it besides add the hole ProjectA jar. Thank you.

Use plug in projects. You can add dependencies to other plugins and access the classes from dependent plugin.

More over modularize your classes based on the functionality. Do not put all your classes in one jar file which is not a good practice and you will realize it when your project grows bigger with lot of functionalities.

To answer your last question, there is no way eclipse can resolve your compilation errors. That's y we are here. The Programmers:-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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