I'm currently trying to find a suitable workflow to execute refactorings across multiple Maven projects, but I cannot find any satisfying solution.
Suppose there are three projects. One project called common and two dependent projects called app1 and app2. Each on a separate Git repository.
Now suppose that a method in common called StringUtils.trim() shall be renamed to StringUtils.getTrimed(). Because this method is used by app1 and app2, those projects need to be adapted, too.
Now, the question is, what is the correct workflow to provide this modification to the development team. Given this situation: A team of about 10 developers with a central SCM server and a central Maven repository server to host the artifacts.
Possible work-flows:
Just commit the changes to the SCM (for all three projects) --> Problem: Developers working on app1 for example probably don't have project common checked out, but are using a binary from the central artifact server. When they fetch the newest version of app1 from the SCM, their build will break. BAD!
Additionally to 1, change the dependency of app1 to point to the SNAPSHOT version of common. --> Problem: When the developers working on app1 fetch the newest version from the SCM, they probably won't get the latest SNAPSHOT of common, if the update policy is set to DAILY (which is the default). BAD!
Additionally to 2, change the update policy for SNAPSHOTS to ALWAYS. --> Problem: Now, the developers of app1 will get the latest SNAPSHOT of common and everything is fine, but only if the SNAPSHOT is deployed to the artifact server before I commit the changes to app1! Furthermore, there is a time period, between the deployment of the common project to the artifact server and my commit of app1 to the SCM. If the developers fetch the latest SNAPSHOT of common, it will be incompatible with the current version of app1 in the SCM, since I have not committed the changes to app1 yet. BAD!
The only workable solution I can come up with is to skip the SNAPSHOT mechanism and work with versions. Here is the work-flow:
- After changing the three projects locally on my machine (before any commit), increase the version of common from say 1.0 to 1.1.
- Commit common to the SCM and deploy it to the artifact server.
- Only after the deployment is done, change the dependencies in app1 and app2 to point to the new version of common and commit app1 and app2.
Problems with this approach: I have to do version management, so this can only be done in coordination with the whole team and considering all dependent projects. Additionally, I have to wait for the common project to be deployed to the artifact server before I can commit my changes to app1 and app2.
Isn't there any easy and flexible mechanism, how to execute such refactorings? I hope that someone can help me. Maybe there is also some misconception on my side.