使用Maven组装目标后如何重新打包到jar? [英] How to repackage to jar after assembly goal using maven?

查看:131
本文介绍了使用Maven组装目标后如何重新打包到jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将多个jar的内容重新打包到jar文件中,所以我使用

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>

问题是,如何将整个包装到罐子中?我是否需要创建一个新的POM来重新包装程序集的输出?

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?

谢谢

推荐答案

您可以将其添加到程序集描述符中

You could add to your assembly descriptor

<format>jar</format>

这篇关于使用Maven组装目标后如何重新打包到jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆