【问题标题】:Location of persistence.xml in appengine-skeleton-archetypepersistence.xml 在 appengine-skeleton-archetype 中的位置
【发布时间】:2015-04-18 14:01:00
【问题描述】:

appengine-skeleton-archetypepersistence.xml的位置在哪里?

【问题讨论】:

  • 你的意思是除了在 META-INF/ 下? (即它在每个 JPA 应用程序上的位置)
  • 我知道它应该在 META-INF 中,但我不知道把这个文件夹放在哪里。

标签: google-app-engine maven jpa


【解决方案1】:

只需将它放在 META-INF 文件夹中,在“myapp/src/main”中创建它

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

【讨论】:

    【解决方案2】:

    据官方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 目录应该是可以互换的。

    【讨论】:

    • 它有效,谢谢。我只想指出@Albertoimpl 的回答也很有帮助。
    • 通过@Albertoimpl 提到的构建路径添加文件夹“src/main/resources/META-INF”在“Java Resources/src/main/resources”中创建 META-INF,由 Eclipse 复制到右侧目录“src/main/webapp/WEB-INF/classes”。
    猜你喜欢
    • 2014-06-14
    • 2011-09-09
    • 2011-12-19
    • 2012-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-09
    相关资源
    最近更新 更多