How to repackage to jar after assembly goal using maven?

情到浓时终转凉″ 提交于 2019-12-11 09:35:05

问题


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


回答1:


You could add to your assembly descriptor

<format>jar</format>


来源:https://stackoverflow.com/questions/9398723/how-to-repackage-to-jar-after-assembly-goal-using-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!