The error happened when:
I want to redeploy a web application and find it cannot compile successfully. The error is that some classes in the “com.solomon/solomon-am-client” dependency cannot be found.
After some investigation, I find the root cause is that, the version “1.0-SNAPSHOT” of “com.solomon/solomon-am-client” used by this project is updated and the classes used in the project are removed from its code.
The following is the final working solution:
Copy the previous working version “solomon-am-client.jar/solomon-am-client.pom/solomon-model.jar/solomon-model.pom” files from the local repository directory to host directory. Rename them to “solomon-am-client-ags.jar/solomon-am-client-ags.pom/solomon-model-ags.jar/solomon-model-ags.pom”.
Update the pom files as following:
Update the “artifactId” to “solomon-model-ags/solomon-am-client-ags” in both pom files and the “solomon-model-ags” dependency in the “solomon-am-client-ags.pom” file. Keep everything else intact.
- Run the following command to deploy the “solomon-model-ags/solomon-am-client-ags” artifacts into the remote repisitory:
# From: https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html
- Update the “pom.xml” of the project which used the “solomon-am-client” dependency:
Note the “artifactId” is updated from “solomon-am-client” to “solomon-am-client-ags”.
Now build the project again and it can finish successfully.
The knowledge here is that: for any “xxx-SNAPSHOT” dependency version, it always uses the latest one. If the latest SNAPSHOT version intruduced some incompatible code comparing to the previous SNAPSHOT version, the problem happens, just like what I described above. So for serious dependency can be used by other project, using version without SNAPSHOT is a good idea.