多webapp Maven 2项目——如何构建单个webapp?
我有以下源布局:
.
├── pom.xml
├── modules (has pom)
│ ├── module1 (has pom)
│ └── module2 (has pom)
│ └── moduleN (has pom)
└── webapp1 (has pom)
└── webapp2 (has pom)
webapp1 和 webapp2 依赖于所有模块(模块是 DAO、服务等)。 目前,我从根目录构建所有内容,mvn package
为我提供了两个 WAR 文件。
如何仅构建 webapp1 或 webapp2?
如果我cd
进入webapp1并运行mvn package
,它会说它无法下载moduleX.jar(这是一个干净的存储库)。当然,Maven 应该能够推断出这些模块需要首先作为依赖项构建?
I have the following source layout:
.
├── pom.xml
├── modules (has pom)
│ ├── module1 (has pom)
│ └── module2 (has pom)
│ └── moduleN (has pom)
└── webapp1 (has pom)
└── webapp2 (has pom)
webapp1 and webapp2 depends on all of the modules (the modules being DAO, services, etc).
At the moment, I build everything from the root and mvn package
gives me two WAR files.
How do I build only webapp1 or webapp2?
If I cd
into webapp1 and run mvn package
it says it can't download moduleX.jar (this is with a clean repository). Surely Maven should be able to deduce that those modules need to be built first as dependencies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用“高级反应器选项”。从根开始:
这告诉 maven 安装
webapp1
以及webapp1
所依赖的项目(以正确的顺序)。帮助(
mvn -h
)记录了这些命令,如下所示:请注意,您需要调用我错了,调用install
,依赖项始终通过本地存储库解析(因此您需要安装
它们)。package
确实有效(我不知道如何/为什么,但它确实有效)。Use "advanced reactor options". From the root:
This tells maven to install
webapp1
and the projects on whichwebapp1
depends (in the right order).The help (
mvn -h
) documents these commands like this:Note that you need to invokeI was wrong, callinginstall
, dependencies are always resolved through the local repository (so you need toinstall
them).package
does work (I don't know how/why, but it does).