persistence.xml 在 appengine-skeleton-archetype 中的位置

Location of persistence.xml in appengine-skeleton-archetype

persistence.xmlappengine-skeleton-archetype 中的位置在哪里?

放在META-INF文件夹里,在里面创建"myapp/src/main"

  1. 右键单击项目文件 -> 构建路径 -> 配置构建路径
  2. 将文件夹 META-INF 添加到构建路径
  3. Maven -> 更新项目

根据官方Google App Engine Documentation for JPA

"正在创建 persistence.xml 文件

JPA 接口在应用程序的 war/WEB-INF/classes/META-INF/ 目录中需要一个名为 persistence.xml 的配置文件。您可以直接在此位置创建此文件,或让您的构建过程从源目录复制此文件。"

这有点令人困惑,因为 Google App Engine Maven project setup/structure 是这样定义的:

$ tree myapp
myapp
    eclipse-launch-profiles
        DevAppServer.launch
        UpdateApplication.launch
    nbactions.xml
    pom.xml
    README.md
    src
        main
            java
            webapp
                WEB-INF
                    appengine-web.xml
                    logging.properties
                    web.xml
        test
    target

但无论如何,war目录和webapp目录应该是可以互换的。