I am creating a project using maven with spring and hibernate. I added a dependency for using javax.persistence package in pom.xml like
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>1.0.2.GA</version>
</dependency>
After adding this dependency tried to import the package javax.persistence but it didn’t showed up. I then downloaded the jar file from mvnrepository related to that and then was able to obviously import the package. I guess, Maven handles the dependency and there should not have been any neccessity of downloading the jar and then adding it to the build path.
Can someone explain where I went wrong?
The .project file has the below content :
<projectDescription>
<name>SampleWebApp</name>
<comment>This is the sample web app. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
I don’t know what the issue was but after deleting the project and creating another one with archetype set to spring it ran successfully. I did read that there some conflicts with m2eclipse and maven-eclipse-plugin. Now, the issue seems to be resolved for now.