如何在Intellij Idea中组织一个大型的Java项目 [英] How to organize a large java project in Intellij Idea

查看:266
本文介绍了如何在Intellij Idea中组织一个大型的Java项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题有点泛泛,但我似乎无法找到在IDEA中打破一个大型项目的最佳方式背后的思想的良好总结。



我的项目由多个组件组成 -

在EC2上运行的grails服务
托管管理网站的grails服务器。
托管一个面向客户的网站的grails服务器
一个android客户端应用程序

用于管理与Amazon上的DynamoDB后端交互的几个定制构建的中间件库。

中间件库旨在供这些组件(包括Android Ap)使用。其中之一就是专门用作各种ocmponenets访问Amazon DynamoDB后端数据的数据层。



所有这些组件的预期用途是什么在IDEA中组织成项目?
中间件是否应该作为一个sperate项目来构建?他们应该如何导入每个组件?作为全球图书馆,复制源文件还是什么?

是否应该在与Grails服务或Android应用程序所在的项目相同的项目中将管理网站构建为单独的包?

IDEA项目结构背后的想法和各个部分(facet / modules / libraries / SDK等等对我来说都有点不透明,但似乎看起来似乎对我来说尤其是在Android应用程序中,我需要小心不要加载大量代码,我并不需要或复制很多代码,以便中间件的维护变得痛苦。



有关这些主题的任何一般指导将不胜感激,或者提供有关该主题的良好参考资料的指引。

>每个组件都应该在Intellij IDEA中组织为一个单独的模块,一个模块可以使用其他模块作为依赖项。


$ b

连接库有多种选择:


  1. 在项目属性的项目结构部分添加jar作为全局库,然后将该库添加到每个使用它的模块中。


  2. 将jar添加为新模块的导出依赖项,然后添加t帽子模块作为对他人的依赖。这种方法的优点是您可以在单个模块中本地化外部依赖关系,这可以帮助您更轻松地维护依赖关系。



I know this quesiton is a bit general, but I can't seem to find a good summary of the thinking behind the optimal way to break up a large project in IDEA.

My project consists of several components --

A grails service running on EC2 A grails server hosting an admin website. A grails server hosting a customer facing website An android client app

Several custom built middleware libraries for managing interaction with a DynamoDB backend on Amazon.

The middleware libraries are intended to be used by several of these componenets (including the Android Ap). One o fthem is specifically to serve as a data layer by which the various ocmponenets access data on the Amazon DynamoDB backend.

What is the intended way that all of these components should be organized into projects in IDEA? Should the middleware be built as a sperate project? How should they be imported in to each of the componenets? As "global libraries", copied source files or what?

Should the "admin website" be built as a separate package within the same project as where the Grails service or the Android application lives?

What is the thinking behind the IDEA "project Structure" and the various sections (facets/modules/libraries/SDKs etc is all a bit opaque to me, but somehow seems to me especially in the Android application I need to be careful not be loading up a ton of code I don't really need or duplicating a lot of the code so that maintenance of the middleware painful.

Any general guidance on these topics would be appreciated, or pointers to good reference material on the topic.

解决方案

Each component should be organized as a separate module in Intellij IDEA. One modules can use others as dependencies.

There are several options for connecting libraries:

  1. Add jars as global libraries in "Project structure" section in project properties. Then add that library to every module using it.

  2. Add jars as exported dependencies for a new module, and then add that module as dependency to others . Advantage of this approach is that you localize external dependencies within a single module, that can help you to make maintaining dependencies easier.

这篇关于如何在Intellij Idea中组织一个大型的Java项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆