复杂的 Maven 组装
我正在尝试编写一个 Maven 程序集,但我不知道如何继续。它相当复杂,所以我谷歌搜索的例子并没有真正的帮助。这就是我想要做的:
- 使用 launch4j 创建安装文件。假设 jar 文件已正确组装(因此需要 Maven 程序集),这部分可以工作。
- 安装程序包含一些依赖项。这些(当前)使用
jar-with-dependencies
descriptorRef
进行组装。这也有效。 - 我需要将一个 war 文件(来自另一个项目)包含到大罐子中。这是我的困惑。
如何创建一个 assembly.xml ,它将执行具有依赖项的 jar(解压所有这些 jar 文件)并包含来自另一个项目(未解压)的 war 文件。
任何帮助将不胜感激。
I'm trying to write a maven assembly and I'm not sure how to continue. It's fairly complicated, so the examples I google don't really help. This is what I'm trying to do:
- Create an installation file using launch4j. This part works, assuming the jar file is correctly assembled (hence the need for a maven assembly.)
- The installation program contains some dependencies. These are assembled (currently) using the
jar-with-dependencies
descriptorRef
. This works as well. - I need to include a war file (from another project) into the big jar. This is my confusion.
How do I create an assembly.xml
that will do both the jar with dependencies (unpacking all of those jar files) and include a war file from another project (which is not unpacked).
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有一个类似于下面的项目结构(我假设一个简单的结构,因为您没有提到任何具体内容):
使用以下 pom.xml:
如您所见,
jar-with-dependencies
描述符,我们将在我们自己的自定义程序集描述符中重用它。现在,自定义
uberjar.xml
:这是
jar-with-dependencies
描述符的一个小变体,它将创建一个 jar:如下所示:
Assuming you have a project structure similar to the one below (I'm assuming a simple structure since you didn't mention anything particular about it):
With the following pom.xml:
As you can see,
jar-with-dependencies
descriptor here, we are going to reuse it in our own custom assembly descriptor.runtime
scope so that we'll be able to include it in the assembly.And now, the custom
uberjar.xml
:This is a little variation of the
jar-with-dependencies
descriptor that will create a jar:As shown below: