简体   繁体   中英

Import only some packages from another eclipse project

I'm coding in Java with Eclipse. I have two projects: ProjectOne and ProjectTwo .

I have some packages in ProjectOne that I want to include in ProjectTwo without including anything else from 'ProjectOne'. How can I do that?

You can create one more project projectThree with your needed classes from ProjectOne in it. Then ProjectOne and ProjectTwo depend on projectThree. I think this is best case scenarios now..

Project Jigsaw which is planned to released in Java 9 should solve your problem. it adds modules to Java.. " modules provide a list of all the packages of this particular module that are considered public API and thus usable by other modules. If a class is not in an exported package, no one outside of your module can access it – even if it is public." More can be found here...(above comment is taken from Below link)

https://blog.codecentric.de/en/2015/11/first-steps-with-java9-jigsaw-part-1/

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