1

每当我启用对 persistence.xml 文件的(Maven)过滤时,我都会收到以下错误:

SEVERE: DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors
No "persistence.xml" files were found in the CLASSPATH yet you specified as input the name ("toto") of a "persistence-unit" to enhance. You must have a valid "persistence.xml" file in the CLASSPATH in a valid location to use this option.
org.datanucleus.enhancer.NucleusEnhanceException: No "persistence.xml" files were found in the CLASSPATH yet you specified as input the name ("toto") of a "persistence-unit" to enhance. You must have a valid "persistence.xml" file in the CLASSPATH in a valid location to use this option.
    at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:785)
    at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525)
    at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258)

在我的 pom.xml 我只是使用这个:

<resources>
    <resource>
         <filtering>true</filtering>
         <directory>src/main/resources/META-INF/</directory>
    </resource>
</resources>
4

1 回答 1

1

META-INF/ 应该从配置的目录元素中删除,否则 Maven 在过滤了 persistence.xml 文件后不会将 META-INF 目录带到 classes 文件夹。

于 2012-10-18T17:01:25.523 回答