packages org.springframework.stereotype and org.springframework.scheduling.annotation do not exist

When I compile my project, I get the following:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------< spring-server-final:spring-server-final >---------------
[INFO] Building spring-server-final 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-server-final ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 6 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ spring-server-final ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 35 source files to D:<User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdtargetclasses
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookUserController.java:[23,37] error: package org.springframework.stereotype does not exist
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookUserController.java:[31,1] error: cannot find symbol
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookUserServiceEndpoints.java:[18,37] error: package org.springframework.stereotype does not exist
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookUserServiceEndpoints.java:[44,1] error: cannot find symbol
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookrepositoryDataDaoImpl.java:[16,37] error: package org.springframework.stereotype does not exist
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookrepositoryDataDaoImpl.java:[23,1] error: cannot find symbol
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookSchedularCron.java:[12,48] error: package org.springframework.scheduling.annotation does not exist
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookSchedularCron.java:[13,48] error: package org.springframework.scheduling.annotation does not exist
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookSchedularCron.java:[14,37] error: package org.springframework.stereotype does not exist
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookSchedularCron.java:[21,1] error: cannot find symbol
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookSchedularCron.java:[22,1] error: cannot find symbol
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookSchedularCron.java:[34,2] error: cannot find symbol
[ERROR] <User>Documentsworkspacesspring-ide-w-git-maven-stscsv_export_qbdsrcmainjavacxfquickbookSchedularCron.java:[64,2] error: cannot find symbol
[INFO] 13 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.629 s
[INFO] Finished at: 2021-10-14T19:16:05-04:00
[INFO] ------------------------------------------------------------------------

When I look online, it references the need to change values in my pom.xml, but I already have those dependencies, at least as far as I can see:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<artifactId>spring-server-final</artifactId>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<groupId>spring-server-final</groupId>
<version>1.0-SNAPSHOT</version>
<name>spring-server-final</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>spring-maven-milestone</id>
<name>Springframework Maven Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
</repositories>
<properties>
<spring.version>4.1.5.RELEASE</spring.version>
<context.path>spring-server</context.path>
<hibernate.version>4.3.8.Final</hibernate.version>
<mysql.version>5.1.10</mysql.version>
<log4j.version>1.2.17</log4j.version>
<slf4j.version>1.7.0</slf4j.version>
<java.version>1.7</java.version>
<cxf.version>2.5.2</cxf.version>
<!-- <cxf.version>3.1.14</cxf.version> -->
</properties>
<dependencies>
<!-- CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<groupId>org.apache.cxf</groupId>
<version>${cxf.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.6.3</version>
</dependency>
<!-- Used to work with the newer excel file format - `.xlsx` -->
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<!-- Form Validation using Annotations -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.2.3.Final</version>
</dependency>
<!-- Hibernate 4 dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0-alpha4</version>
</dependency>
<!-- Log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>runtime</scope>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
<version>${slf4j.version}</version>
</dependency>
<!-- GSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.1</version>
</dependency>
<!-- JAXB -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.opencsv/opencsv -->
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.2</version>
</dependency>
</dependencies>
<build>
<finalName>spring-server-final</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

So what is wrong?

What is weird is that this worked in 2019 or 2020 on someone else’s computer, just cannot get it to work on mine.

Edit 10/17/2021, output from mvn clean dependency:tree:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------< spring-server-final:spring-server-final >---------------
[INFO] Building spring-server-final 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-server-final ---
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ spring-server-final ---
[INFO] spring-server-final:spring-server-final:war:1.0-SNAPSHOT
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.5.2:compile
[INFO] |  +- org.apache.cxf:cxf-common-utilities:jar:2.5.2:compile
[INFO] |  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile
[INFO] |  |  - org.codehaus.woodstox:woodstox-core-asl:jar:4.1.1:runtime
[INFO] |  |     - org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO] |  +- org.apache.cxf:cxf-api:jar:2.5.2:compile
[INFO] |  |  +- org.apache.neethi:neethi:jar:3.0.1:compile
[INFO] |  |  - wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] |  +- org.apache.cxf:cxf-rt-core:jar:2.5.2:compile
[INFO] |  |  - org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] |  +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.5.2:compile
[INFO] |  +- org.apache.cxf:cxf-rt-transports-http:jar:2.5.2:compile
[INFO] |  |  - org.apache.cxf:cxf-rt-transports-common:jar:2.5.2:compile
[INFO] |  - org.codehaus.jettison:jettison:jar:1.3.1:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.5.2:compile
[INFO] |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  +- asm:asm:jar:3.3:compile
[INFO] |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-tools-common:jar:2.5.2:compile
[INFO] |  |  - org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.5.2:compile
[INFO] |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.5.2:compile
[INFO] |  - org.apache.cxf:cxf-rt-ws-addr:jar:2.5.2:compile
[INFO] +- joda-time:joda-time:jar:2.9.4:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.6.3:compile
[INFO] |  - com.fasterxml.jackson.core:jackson-core:jar:2.6.3:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.6.3:compile
[INFO] |  - com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.6.3:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.17:compile
[INFO] |  +- org.apache.poi:poi:jar:3.17:compile
[INFO] |  +- org.apache.poi:poi-ooxml-schemas:jar:3.17:compile
[INFO] |  |  - org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] |  |     - stax:stax-api:jar:1.0.1:compile
[INFO] |  - com.github.virtuald:curvesapi:jar:1.04:compile
[INFO] +- org.springframework:spring-core:jar:4.1.5.RELEASE:compile
[INFO] |  - commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.springframework:spring-context:jar:4.1.5.RELEASE:runtime
[INFO] |  - org.springframework:spring-expression:jar:4.1.5.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.1.5.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:4.1.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:4.1.5.RELEASE:compile
[INFO] |  - org.springframework:spring-tx:jar:4.1.5.RELEASE:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.10:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.1.5.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:4.1.5.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.1.5.RELEASE:compile
[INFO] |  - aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-aspects:jar:4.1.5.RELEASE:compile
[INFO] |  - org.aspectj:aspectjweaver:jar:1.8.5:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.5.3:compile
[INFO] |  - com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile
[INFO] +- commons-collections:commons-collections:jar:3.2:compile
[INFO] +- org.springframework:spring-oxm:jar:4.1.5.RELEASE:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.2.3.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile
[INFO] |  - com.fasterxml:classmate:jar:1.1.0:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.3.8.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  - org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-c3p0:jar:4.3.8.Final:compile
[INFO] |  - com.mchange:c3p0:jar:0.9.2.1:compile
[INFO] |     - com.mchange:mchange-commons-java:jar:0.2.3.4:compile
[INFO] +- org.json:json:jar:20160810:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.0-alpha4:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.0-beta1:compile
[INFO] |  - commons-codec:commons-codec:jar:1.3:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.0:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.0:runtime
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.0:runtime
[INFO] +- com.google.code.gson:gson:jar:2.6.1:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.2.7:compile
[INFO] |  +- com.sun.xml.bind:jaxb-core:jar:2.2.7:compile
[INFO] |  |  - com.sun.istack:istack-commons-runtime:jar:2.16:compile
[INFO] |  - com.sun.xml.fastinfoset:FastInfoset:jar:1.2.12:compile
[INFO] |     - javax.xml.bind:jsr173_api:jar:1.0:compile
[INFO] +- org.eclipse.persistence:org.eclipse.persistence.moxy:jar:2.5.0:compile
[INFO] |  +- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.5.0:compile
[INFO] |  |  - org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.5.0:compile
[INFO] |  - org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.5.0:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- xom:xom:jar:1.2.5:compile
[INFO] |  +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] |  +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] |  - xalan:xalan:jar:2.7.0:compile
[INFO] +- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] - com.opencsv:opencsv:jar:4.2:compile
[INFO]    +- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO]    +- org.apache.commons:commons-text:jar:1.3:compile
[INFO]    - org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.931 s
[INFO] Finished at: 2021-10-17T22:20:02-04:00
[INFO] ------------------------------------------------------------------------

Answer

I fixed this by changing

        <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

to

        <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

From other posts, I noticed some people fixed the problem of dependencies not downloading by changing <scope>runtime</scope> to <scope>compile</scope>. Since my problem seemed to be related to missing dependencies, I figured this was worth a try. Since I am not the original developer of this project, I am not 100% sure why they used runtime here. I know what runtime is used for is discussed in various places, such as here, but I never use it on purpose, so don’t have much experience with it. As such, I cannot fully explain why changing “runtime” to “compile” fixed it.