我正在尝试在maven中构建我的Jhipster Spring启动应用程序。但是,Maven没有在调试模式下构建。否则,它工作正常。
我添加了以下依赖项,没有帮助。
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
Description:
An attempt was made to call the method javax.persistence.PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType; but it does not exist. Its class, javax.persistence.PersistenceContext, is available from the following locations:
jar:file:/C:/Users/User/Documents/audio-book-admin/lib/javax.persistence.jar!/javax/persistence/PersistenceContext.class
jar:file:/C:/Users/User/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.2.Final/hibernate-jpa-2.1-api-1.0.2.Final.jar!/javax/persistence/PersistenceContext.class
jar:file:/C:/Users/User/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar!/javax/persistence/PersistenceContext.class
It was loaded from the following location:
file:/C:/Users/User/Documents/audio-book-admin/lib/javax.persistence.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.persistence.PersistenceContext
那么,我如何正确纠正我的应用程序的类路径以解决上述问题?我是Spring的新手!
首先在你的存储库中删除目录hibernate,然后进行maven clean install以正确地重新导入你的依赖项。
如果它仍然无法修复您的问题,请创建一个maven树:依赖关系来检测导致问题的依赖关系并将其排除在您的pom中