[英]Maven tar target output folder
我目前有一个这样的Maven项目:
-parent module/
-child_module1/
-scripts_directory/
-src/
-main/
-java/
-resources/
-test/
-child_module2/
-scripts_directory/
-src/
-main/
-java/
-resources/
-test/
-child_module3/
... (same structure as above child modules)
在构建项目时,它将为每个子模块创建一个jar,并将其传输到执行路径之外的公共目录; 也将每个子模块的所有dependencies
项也复制到该相同目录中; 将每个子模块的scripts_directory
的内容复制到另一个公共目录中; 最后将所有resources
放入另一个公用目录
因此,运行mvn install之后的最终结构为:
/packages/mymavenapp/
-conf/ (contains all the resources of each child module's resources)
-lib/ (contains all the child module jars (compiled) and their dependencies)
-child_module1.jar
-child_module2.jar
-child_module3.jar
-spring jars
-more dependency jars
-scripts/ (contains all the contents of each child's scripts_directory)
-run_child1_jar.pl
-run_child2_jar.pl
-run_child3_jar.pl
我目前正在使用此构建结构。 我想tar
目录/packages/mymavenapp
到mymavenapp.tar.gz
并将其推到它的节点。
我知道我可以拥有一个可将该目录变成tar的shell脚本,但想知道是否可以在maven构建周期中轻松完成此操作
编辑:
最终目标目录的位置并不重要,因此目标目录
mymavenapp/
只要mymavenapp/
的结构及其内容(即..)保持相同,就可以在父模块的目录中。 mymavenapp/conf/
; mymavenapp/lib/
; mymavenapp/scripts/
您可以在saperate构建配置文件中使用maven-assembly插件,在构建结束时使用该构建配置文件调用maven构建
程序集插件非常灵活,它需要一个配置文件,您可以在其中定义输入文件以及该文件在tar文件中的位置以及最终tar文件的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.