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>

 

posted @ 2019-07-16 22:00  努力挣扎的小兵  阅读(1752)  评论(0编辑  收藏  举报