You can do it in 2 ways.
Export the other project to jar and import the jar in your project.
OR
In the dependency you can add the other projects to your project. Right click on project --> properties --> java build path --> projects. Add your project here