Maven项目导出jar包,包含依赖

1. Maven项目导出jar包,包含依赖:
mvn dependency:copy-dependencies package

2. 可以在Project创建lib文件夹,输入以下命令:
mvn dependency:copy-dependencies -DoutputDirectory=lib package

3. 可以设置依赖级别,通常用编译需要的jar
mvn dependency:copy-dependencies -DoutputDirectory=lib -DincludeScope=compile package

4.或者直接在pom.xml中添加:

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- <archive>
<manifest>
此处指定main方法入口的class
<mainClass>com.xxx.uploadFile</mainClass>
</manifest>
</archive> -->
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
上一篇:Eclipse中Maven项目添加jar包


下一篇:来到这里,我放弃了多少- UI基础-疯狂猜图,我们都疯狂了-