Blueming
EL PSY CONGROO
如何在打包普通Maven工程时引入所有依赖包

在pom.xml中添加插件

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase> <!-- packaging phase -->
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>

然后在打包时运行命令

mvn clean assembly:assembly

运行结束后就会在target文件夹中生成两个jar,其中已jar-with-dependencies结尾的文件就是包含所有依赖的jar包