java - 如何在不同模块中处理App Engine模块Java中的公共(public)类?

标签 java module google-app-engine gae-module

目前我正在研究 Google App Engine 模块。我指的是the documentation

我对如何处理模型类或公共(public)类感到困惑。 以前我使用后端,因为所有代码都保存在项目中,但现在使用模块,我不知道如何管理公共(public)代码

最佳答案

我创建了 Appstart ( https://github.com/omerio/appstart ) 一个基于样板 Maven 的多模块 App Engine 应用程序,它演示了 Guice、Jersey、Objectify、Cloud EndPoints 等技术的使用,并具有 3 个模块:前端模块、后端模块和通用模块模块包含所有公共(public)类(包括模型),它应该向您展示如何管理公共(public)代码的示例。该文件夹包含以下模块/maven项目

  • 应用程序启动后端
  • appstart-common
  • appstart-ear
  • 应用程序启动前端

后端模块仅包含后端所需的代码,前端包含前端代码,公共(public)模块包含公共(public)代码。这些项目设置在具有父级 Maven POM 的父文件夹“appstart”内。使用 Maven 依赖项将公共(public)模块包含在前端和后端中:

<!-- Common module dependency -->
    <dependency>
        <groupId>uk.co.inetria.appstart</groupId>
        <artifactId>appstart-common</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

当您更改通用代码时,您可以运行 mvn clean,然后从 appstart-ear 目录进行安装,它应该会更新所有依赖的项目。我希望这有帮助

关于java - 如何在不同模块中处理App Engine模块Java中的公共(public)类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26259418/

相关文章:

Java Android Rectangle.intersects 在循环中无法正常工作

java - 代码中 "System.out.println( DECIMAL )"总是输出相同的DECIMAL吗?

java - 使用 XQJ JSR 225 的 Xquery

java - 预留实例和预热请求不起作用

Java ASM GeneratorAdapter变量命名

windows - Windows 事件日志中的应用程序错误,错误模块名称未知,为什么?

php - 从模型名称获取模块名称

module - 在 Rust 中公开嵌套模块

python - 在 Google App Engine 上放置自定义错误页面的位置

java - 使用 Siena 进行非规范化数据建模