i get package org.springframework.stereotype error as im running mvn install. even in .m2 folder there is that package.
error showing me tho this line of code :
import org.springframework.stereotype.Service;
dependencies are :
<springVersion>4.1.1.RELEASE</springVersion>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springVersion}</version>
</dependency>
is there something i missed ?
UPDATE
here is full lines of error i get :
ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project mynewProject: Compilation failure: Compilation failure:
[ERROR] /C:/mynewProject/src/main/java/com/web/server/domain/service/WebServiceImpl.java:[17,38] package org.springframework.stereotype does not exist
[ERROR] /C:/mynewProject/src/main/java/com/web/server/domain/service/WebServiceImpl.java:[25,2] cannot find symbol
I got similar issues when on my standalone java program when running on java 8 and spring 4.x.
For some reason, i don't see spring-context in the referenced Jars of the project. It should be automatically referenced by maven, but I did not see that happening.
Solution : I added the spring-context dependency manually in the pom.xml and my error is fixed.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.5.RELEASE</version>
</dependency>
I needed to change the scope-tag to 'compile' instead of 'runtime', and the error went away.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
All the dependencies should be within
<dependencies>
...
</dependencies>
... or your code will continue throwing that error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With