如何使用 Maven 为项目构建 tarball?
好的,让我做好准备。我有一个父 pom project_maven
,它的 POM 中包含 3 个模块:project_common
、project_explode
和 project_client
。 project_client
依赖于 project_common
和 project_explode
。 project_client
还包含一个 /ext
目录,其中包含第三方可执行文件、脚本等。
在我们当前的项目 Ant 构建中,有一个目标 build-client-tarball
,将/ext
目录复制到构建目录,将project_common.jar和project_explode.jar
文件复制到构建目录,并对整个目录进行压缩包 事物。
我想在 Maven 中复制此行为,而不必求助于调用 ant 任务。据我所知,程序集插件可能是可行的方法,但我无法弄清楚如何让它工作。似乎我需要一个自定义程序集描述符?有人有我可以使用的样板或示例吗?
OK, lemme set the stage. I have a parent pom, project_maven
, that contains 3 modules in its POM, project_common
, project_explode
, and project_client
. project_client
has dependencies on both project_common
and project_explode
. project_client
also contains an /ext
directory, which contains third-party executables, scripts, etc.
In our current Ant build of the project, there is a target, build-client-tarball
, that copies the /ext
directory to the build directory, copies the project_common.jar and project_explode.jar
files into specific locations in the build dir, and tarballs the whole thing.
I'd like to duplicate this behavior in maven without having to resort to calling the ant tasks. From what I can tell, it looks like the assembly plugin might be the way to go, but I'm having trouble figuring out how to get it to work. Seems like I would need a custom assembly descriptor? Anybody have any boilerplate or examples I can work from?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 Maven Assembly 插件。值得花精力去研究它。它会完全满足您的需要。
您可以使用它来包含依赖项和源。查看此链接。那里有一堆示例程序集描述符。您需要定义一种格式
tar
以便它为您生成 tar。此外,您还需要定义
以包含您提到的模块。You need to use the Maven Assembly plugin. It's worth the effort to investigate it. It will do exactly what you need.
You can use it to include dependencies and sources. Have a look at this link. There're a bunch of sample assembly descriptors there. You need to define a format
tar
in order for it to produce a tar for you. In addition, you also need to define<dependencySets/>
in order to include the modules you mentioned.