如何使用 Maven 为项目构建 tarball?

发布于 2024-11-19 03:02:03 字数 604 浏览 8 评论 0原文

好的,让我做好准备。我有一个父 pom project_maven,它的 POM 中包含 3 个模块:project_commonproject_explodeproject_clientproject_client 依赖于 project_commonproject_explodeproject_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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜中书 2024-11-26 03:02:03

您需要使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文