开发者

How can I use maven to build a tarball for a project?

开发者 https://www.devze.com 2023-03-18 09:33 出处:网络
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_clie开发者_开发技巧nt. project_client has dependencies on b

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_clie开发者_开发技巧nt. 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号