窗口->首选项->Java 持久化->JPA->错误/警告->持久化单元
“JAR 文件无法解析”设置只需为
“忽略”
在
Multiple annotations found at this line:
- JAR file "lib/${project.persistencejar}.jar" cannot be resolved
- The path to the JAR file will vary on your runtime environment. Please make sure the
specified path fits your particular environment.
中替换整个
persistence.xml
标签,即 <jar-file>
然后包含在
<persistence-unit name="PersistenceUnit" transaction-type="JTA">
...
<!-- here is where the jar file is supposed to go -->
${importjarfile}
...
</persistence-unit>
属性中
pom.xml
或者在
<properties>
<!-- jar of persistence -->
<importjarfile><![CDATA[<jar-file>lib/${project.persistencejar}.jar</jar-file>]]></importjarfile>
</properties>
文件中输入该行
src/main/filters/profilename.properties
这样 Eclipse 就不会看到
importjarfile = <jar-file>lib/${project.persistencejar}.jar</jar-file>
标签,也不会抱怨。在构建时,maven 将生成正确的持久性 xml。