[英]How to package jar from one project to another in maven multimodule project
I need a best-practice solution for the following problem. 我需要以下问题的最佳实践解决方案。 I have a maven multi-module project with 3 subprojects: 我有一个包含3个子项目的Maven多模块项目:
module-*-that-uses-client is a bunch of static xml config files with a client-module.jar which is packaged as a .zip file. module-*-that-uses-client是一堆带有client-module.jar的静态xml配置文件,该文件打包为.zip文件。 So, the packaged structure of a module-*-that-uses-client would look like: 因此,使用客户端的模块的打包结构如下所示:
I wonder how I can implement following build strategies. 我不知道如何实现以下构建策略。 If I build client-module, then: 如果我构建客户端模块,则:
If I build any of module-*-that-uses-client, then: 如果我构建使用客户端的任何模块-*,则:
Appreciate any help on this problem. 感谢有关此问题的任何帮助。
One solution would be the usage of --also-make
and --also-make-dependents
. 一种解决方案是使用--also-make
和--also-make-dependents
。
--also-make
builds all dependencies of the specified module. --also-make
生成指定模块的所有依赖项。 Example: mvn --projects module-1-that-uses-client --also-make clean install
builds client-module and module-1-that-uses-client in this order. 示例: mvn --projects module-1-that-uses-client --also-make clean install
将按此顺序构建客户端模块和module-1-that-uses-client。
--also-make-dependents
builds the specified module and all other modules with a dependency to the specified module. --also-make-dependents
生成指定模块以及所有其他与指定模块相关的模块。 Example: mvn --projects client-module --also-make-dependents clean install
builds first client-module and then both module-*-that-uses-client. 示例: mvn --projects client-module --also-make-dependents clean install
会先构建客户端模块,然后再构建两个模块-*-that-uses-client。
See also the Guide to Working with Multiple Modules . 另请参阅《使用多个模块的指南》 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.