I have project B which depends on project A.
On project B's pom.xml file, I have declared A dependency as:
<dependency>
<groupId></groupId>
<artifactId>A</artifact>
<version>1</version>
<scope>compile</scope>
</dependency>
But every time I make any changes on project A, I have to run maven install on eclipse, to install the project to my user's repository.
How can I make sure project A is built and installed before project B is built and ran?
Use a module with packaging=pom to control the entire build. In another Eclipse project, call it top-level, have this pom:
Then perform your maven operations (clean, install, etc.) on this pom. Maven will figure out the right order for processing the modules.
One word of warning: Maven uses the file system to access the relative pom locations for A and B. This only works if all three projects are under the same root directory (the Eclipse workspace root, the git repo root directory, etc.)