在 persistence.xml 中使用 Maven 过滤时出现 Eclipse 错误

问题描述 投票:0回答:2
maven jar persistence filtering
2个回答
6
投票
中禁用它

窗口->首选项->Java 持久化->JPA->错误/警告->持久化单元

只需为
“JAR 文件无法解析”设置

“忽略”


1
投票

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。

    

© www.soinside.com 2019 - 2024. All rights reserved.