This is a very common usecase and nicely covered as maven multimodule project. Check the link for a simple example http://docs.codehaus.org/display/MAVENUSER/Multi-modules+projects. For local development it's enough to run mvn install. In a bigger project or shared environment you will need a maven repository.
Update:
Alternative link: Multi-module project builds with Maven and Gradle