Reputation: 11499
In pom.xml for hibernate:
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
</dependency>
there is not version. But when I add to my application pom in Eclipse I receive error that version must be. Why this difference? Thanks.
Upvotes: 3
Views: 1621
Reputation: 176
There are two ways of resolving these issue:
-insert yourself the version such that Maven knows what dependency you need (it either searches in the local repository for it or downloads from a maven repository or you can give it a link from where to download it)
-add a parent that uses the artifact that you are calling and then you don't need the version (it takes the parent version)
Upvotes: 1
Reputation: 47637
The extract you saw in the dependencies of hibernate actually has a version which is defined in a parent pom, in its dependencyMgmt section. This allows to only define in one place the version to use and all children of that parent pom only need to indicate which dependency they want and they automatically get the version specified in the parent.
Add a <version>
in your case, or also use a dependencyMgmt section in your pom.xml to indicate the version of hibernate-jpa-2.0-api you want.
Upvotes: 1
Reputation: 25929
The 2.0 is the version of the JPA supported not the version of the artifact
try
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
Arnon
Upvotes: 4
Reputation: 490597
Maven needs to know what version to download/check.
Add a version
element as a child of dependency
.
Upvotes: 2