如何使用maven组装目标后重新打包为jar?
我需要将多个 jar 的内容重新打包到一个 jar 文件中,因此我使用 Maven程序集插件 将 jar 解压到程序集目录。这是通过一个相当标准的程序集描述符完成的:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>assembly</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>**/dll/**</exclude>
<exclude>**/dylib/**</exclude>
<exclude>**/so/**</exclude>
</excludes>
</unpackOptions>
<scope>runtime</scope>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes>
<include>com.corp*:*</include>
</includes>
<excludes>
<exclude>com.corp*:*-xb-*</exclude>
<exclude>com.corp*:juniper</exclude>
</excludes>
</dependencySet>
</dependencySets>
<files>
<file>
<source>about.txt</source>
<outputDirectory>/lib</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>
问题是,如何将整个东西打包到 jar 中?我是否需要创建一个新的 POM 来重新打包程序集的输出?
谢谢
I need to repackage to a jar file the content of multiple jars so I use Maven assembly plugin to unpack the jars to the assembly dir. This is done with a pretty standard assembly descriptor:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>assembly</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>**/dll/**</exclude>
<exclude>**/dylib/**</exclude>
<exclude>**/so/**</exclude>
</excludes>
</unpackOptions>
<scope>runtime</scope>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes>
<include>com.corp*:*</include>
</includes>
<excludes>
<exclude>com.corp*:*-xb-*</exclude>
<exclude>com.corp*:juniper</exclude>
</excludes>
</dependencySet>
</dependencySets>
<files>
<file>
<source>about.txt</source>
<outputDirectory>/lib</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>
The problem is, how do I package the whole thing to a jar? Do I need to create a new POM just to repackage the output of the assembly?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以添加到程序集描述符中
You could add to your assembly descriptor