assembly插件: dependencySets

classpath只加载当前服务需要的jar包(配置:dependencySet)

参考 hadoop打包方法:hdfs、yarn、MR所需要的jar放到不同目录下:

    <dependencySets>
        <dependencySet>
            <!--是否把本项目添加到依赖文件夹下:-->
            <useProjectArtifact>false</useProjectArtifact>
            <!-- 将项目所有依赖包拷贝到发布包的lib目录下 :-->
            <outputDirectory>lib</outputDirectory>
            <!-- 符合runtime作用范围的依赖会被打包进去: -->
            <scope>runtime</scope>
        </dependencySet>
        <dependencySet>
            <includes>
                <include>cn.ucloud.uds:uds-web</include>
            </includes>
            <!--是否把本项目添加到依赖文件夹下:-->
            <useProjectArtifact>false</useProjectArtifact>
            <!-- 将项目所有依赖包拷贝到发布包的lib目录下 :-->
            <outputDirectory>lib/web</outputDirectory>
            <!-- 符合runtime作用范围的依赖会被打包进去: -->
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
原文地址:https://www.cnblogs.com/muzhongjiang/p/13322286.html