多模块项目。包括:主模块和子模块:客户端,共享服务器。如何? [英] Multi module project. Consist of : parent module and submodules: client, shared, server. How to?
问题描述
我想有web应用程序的多模块项目。有父
模块的内容3子模块:
I would like to have multimodule project of web app. There is parent
module that content 3 submodules:
客户端
,共享
,服务器
。
我想建立一个与Maven。
I would like to build that with maven.
我想客户端
可以访问:服务器
和共享
模块code。
I would like to client
could access: server
and shared
modules code.
我想共享
可以访问:服务器
模块code
I would like to shared
could access: server
modules code.
依赖我wonna实现
client -> shared -> server
client -> server
难道是用Maven构建?
Can it be build with maven?
下面是我目前的劲歌:
父:
<modules>
<module>server</module>
<module>shared</module>
<module>client</module>
</modules>
客户端:
<dependencies>
<dependency>
<groupId>pl.derp</groupId>
<artifactId>shared</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>pl.derp</groupId>
<artifactId>server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
共享不依赖
服务器:
<dependencies>
<dependency>
<groupId>pl.derp</groupId>
<artifactId>shared</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
修改
我想有我的共享
模块能够获得服务器
模块code,但是当我添加依赖关系服务器
模块共享
模块内,我收到关于循环依赖一个错误,并且不能建立项目。我的问题是如何prepare劲歌所有子模块实现这一目标?正如你可以看到共享
模块没有任何相关性了。 -
I would like to have my shared
module had access to server
module code, but when I add dependencies to server
module inside shared
module, I am getting an error about cycle dependencies and can not build project. My question is how to prepare poms in all submodules to achieve this? As You can see shared
module doesn't have any dependencies now. –
推荐答案
我倾向于尝试,使生活更简单,只是有两个模块(模式,代理服务器和客户端code)。
I'd tend to try and make life simpler and just have two modules (for model, proxies and client code).
例如
model (maven project)
webclient (maven project)
shared (package)
server (package)
client (package)
我不完全相信你一定能因为交叉依赖三个模块做到这一点。
I'm not totally sure you can do it with three modules because of the cross dependencies.
FWIW我们有数据库,模型和客户端(GWT Web客户端)作为分割的主要关切,并保持相关性松潘县的模块。
FWIW we have modules for database, model and client (gwt web client) as that splits the main concerns and keeps the dependencies sane.
这篇关于多模块项目。包括:主模块和子模块:客户端,共享服务器。如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!