0

When I add dependendencies, one of the dependency (spring-context) not exist in Maven Dependencies as given below:

missing maven jars

What I have done so far is:

Project -> Clean Maven ->Update Maven Project

And these steps are applied :

https://stackoverflow.com/a/9761685/12100307

pom.xml:

...<dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>5.3.10</version>
            <type>module</type>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.3.10</version>
            <type>module</type>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context  </artifactId>
            <version>5.3.10</version>
            <type>module</type>
        </dependency>
    </dependencies>...
Denisa
  • 125
  • 4
  • 16
  • It happens to me all the time, most of the times its problems with IDE cache. I don't know how to do it in eclipse but in intellij you can simply `invalidate caches and restart`. – Gonnen Daube Oct 01 '21 at 17:54
  • 1
    What is the `module` ? Remove that... and rebuilt on plain command.. – khmarbaise Oct 01 '21 at 18:11

1 Answers1

0

After some .m2 clean, dependency clean, maven -> update project etc. reindexing etc. the problem is solved by updating pom.xml as below:

Hope helps you too!

... <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <spring.version>5.0.2.RELEASE</spring.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </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>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
    </dependencies>
...
Denisa
  • 125
  • 4
  • 16
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 04 '21 at 11:28