The story is about maven project dependencies. I have:
- my project depends on hibernate-core:5.2.10.Final artifact which depends on hibernate-jpa-2.1-api:1.0.0.Final
- and my project depends on javaee-api:7.0
- hibernate-jpa-2.1-api:1.0.0.Final contains javax.persistence.* classes
- the same javax.persistence.* classes are contained in javaee-api:7.0
Which dependency should i use in my project and with wich scope? If i leave both dependencies in final build then i will get a class-conflict. It is desirable that the application can be deployed to any JavaEE container such as Glassfish, Wildfly, JBOSS, etc.
Note that hibernate-jpa-2.1-api is not specific api for any JavaEE server and is not implementation. It is just API compile-scope dependency of hibernate-core artifact. And i don't include this dependency manually, if i choose Hibernate as JPA implementation then hibernate-jpa-2.1-api will be included in build by default.