Build multiple Maven projects
I'm very new to Maven, and have a question about building multiple Maven projects.
We have two Maven projects, Project A and Project B.
Project A depends on an artefact generated by Project B.
When changes to project A or B are checked into SVN, our local Hudson server builds the modified project (and any depe开发者_Go百科ndent projects) and uploads the artefacts into our local Nexus repository.
Now, consider two developers.
Developer 1 hacks away at project A only, and when Developer 1 builds project A locally, Maven goes and gets the latest project B snapshot artefact from our Nexus server.
Developer 2 hacks on both project A and project B simultaneously. When Developer 2 builds project A locally, we want maven to build project B with any local changes and use the resulting artefact to build project A. How do we set up Maven to build using the local version of project B instead of getting the artefact from Nexus? Is this a standard usage pattern for Maven?
How do we set up Maven to build using the local version of project B instead of getting the artefact from Nexus?
You can setup an updatePolicy
for the snapshots artifacts per repository. Actually, Maven checks for SNAPSHOT updates only once a day by default. So if you build a version of B locally, you should be able to use it to build A for some time, even if a new SNAPSHOT is deployed to your Nexus. If this doesn't suit your needs, you can change this policy. You could also build offline (using the -o
option).
PS: AFAIK, automatic updates will be disabled by default in Maven 3.x, you will have to explicitly ask for updates (with the -U
option).
精彩评论