[英]How to copy content from maven module target directory to the parent
I have a maven project which has 2 maven modules ie module 1 and module 2. Below is the structure of the project 我有一个Maven项目,其中有2个Maven模块,即模块1和模块2。下面是项目的结构
Parent 父级
-- module 1
-- pom.xml
-- module 2
-- pom.xml
-- pom.xml
Now when i build the project, both module 1 and module 2 build directory will have a jar and xml file. 现在,当我构建项目时,模块1和模块2的构建目录都将具有jar和xml文件。
What i want to achieve is to have content of build directory of both module 1 and module 2 to be copied to a specific directory structure under parent when i build the project. 我想要实现的是在构建项目时,将模块1和模块2的构建目录的内容复制到父目录下的特定目录结构中。
Please can you suggest on how i can achieve this ? 请您就我如何做到这一点提出建议?
You can use maven-resources-plugin to do this. 您可以使用maven-resources-plugin执行此操作。
Configure it to copy all needed files to your wanted path, and bind the execution during the phase install of both module 1 and 2. 配置它以将所有需要的文件复制到所需的路径,并在模块1和2的阶段安装期间绑定执行。
Doing this, when the module has just been compiled and artifacts produced, the resource plugin will execute and copy your files. 这样做时,在刚刚编译模块并生成构件时,资源插件将执行并复制您的文件。
You can find the documentation of the plugin here: https://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html 您可以在此处找到该插件的文档: https : //maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.