I have been having numerous problems with Eclipse on two different Macs since Eclipse upgraded to 2022-09 (4.25.0). After many fresh installs and imports, I am still having an issue with with the Maven plugin and Maven dependencies.
Maven Integration for Eclipse (2.0.4.20220904-1703) is installed. Eclipse is launched with Java 17, a requirement for M2E 2.0.1 and above. The Maven Nature is present. The facet Dynamic Web Module 4.0 is enabled with Tomcat 9.0 as its runtime. I added Maven Dependencies equal to WEB-INF/lib to the Deployment Assembly. Doing so adds <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> to the MAVEN2_CLASSPATH_CONTAINER <classpathentry> in my project's .classpath file.
However, if I select Project -> Update Maven Project, Eclipse (or M2E) removes Maven Dependencies from the Deployment Assembly, removes the org.eclipse.jst.component.dependency attribute from MAVEN2_CLASSPATH_CONTAINER, and deletes the *.jar files from my project in Tomcat wtpwebapps/myapp/WEB-INF/lib. Of course my app will not deploy properly if I start the server.
The workaround I've hit on is to open ./classpath in a text editor and add <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> to MAVEN2_CLASSPATH_CONTAINER. Then when the server starts the correct *.jar files are copied to wtpwebapps/myapp/WEB-INF/lib and my app runs.
These steps are perfectly repeatable--I've done it many times. I've tried different combinations of Maven preferences, and still it happens exactly this way. The project's pom.xml is complete; it compiles, tests, and packages the project perfectly. Why is this Eclipse error happening? Why is M2E resetting the Deployment Attributes, and how can I stop this from happening? I've tried setting .classpath to read-only, but then Maven will not update my project. It insists on stomping the correct settings.
BTW, I see this problem frequently described here, but for much older versions of Eclipse and M2E (some going back over 10 years). I've exhausted myself trying various recommendations. The closest I've come is the workaround described above.