I have two IntelliJ IDEA Java projects; ProjectA and ProjectB. I want to import and use code from ProjectA in ProjectB. How do I do this?
In Eclipse I would simply g
Eclipse's concepts of "workspace" and "project" are matched by IntelliJ IDEA's "project" and "module". So one way of doing this is to create a project, say ProjectAB, and import your two existing ProjectA and ProjectB as modules, I'll call them ModuleA and ModuleB.
Right after that make sure that in the project tree both modules have correct folders marked as "source" folders (in my case they are ModuleA/src/main/java and ModuleB/src/main/java).
Then you have to configure ModuleB to depend on ModuleA (ModuleB > Dependencies> Add > Module Dependency).