I specified dependency version 75.1.3 in my pom.xml pointing to one of my other projects:
<properties>
<myotherproject.version>75.1.3</myotherproject.version>
</properties>
<dependencies>
<dependency>
<groupId>com.myotherproject</groupId>
<artifactId>MyOtherProject</artifactId>
<version>${myotherproject.version}</version>
</dependency>
<dependencies>
But when I maven build (clean install) the main project, maven always downloads some other version 75.1.1:
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from maven-local: https://mycompany.com/maven-local/com/myotherproject/MyOtherProject/75.1.1/MyOtherProject-75.1.1.pom
[INFO] Downloaded from maven-local: https://mycompany.com/maven-local/com/myotherproject/MyOtherProject/75.1.1/MyOtherProject-75.1.1.pom (6.0 kB at 19 kB/s)
[INFO] Downloading from maven-local: https://mycompany.com/maven-local/com/myotherproject/MyOtherProject/75.1.1/MyOtherProject-75.1.1.jar
[INFO] Downloaded from maven-local: https://mycompany.com/maven-local/com/myotherproject/MyOtherProject/75.1.1/MyOtherProject-75.1.1.jar (329 kB at 918 kB/s)
I've looked for that version 75.1.1 and it's mentionned nowhere in the project. The dependency to the other project is defined only at that one place. When I delete the corresponding folder 75.1.1 from the .m2 folder, it downloads it again at each build. And of course, the build fails due to a missing symbol (present only after 75.1.1).
I tried specifying versions: 75.1.2, 75.1.3, 75.1.4-SNAPSHOT in the pom.xml, but it always uses 75.1.1.
I've also tried forcing the maven-compiler-plugin version to 3.10.1 but it's not fixing the problem.
I don't know what else to try now... I'm using Eclipse IDE.
I finally found the cause. The version in the pom.xml of my main project had been updated, but not the version in the pom.xml of its child projects. Thus the child projects were built based on an old snapshot, referencing an older version of the dependency (the other project).
What I was thinking it was:
Parent project 5.2.2 -----> Children projects 5.2.2 --x--> Other project 75.1.3
What it actually was:
Parent project 5.2.2 --x--> Children projects 5.1.3 -----> Other project 75.1.1
So the problem was between the parent project and its children projects, not the fault of the maven dependency.