Using another job as dependency

I have a Java project with a local maven repo dependency. What I want to achieve is to compile this in CI in any way. I was thinking of someway get another job (The other project) as a dependency.

Any ideas on how to achieve this?