maven assembly 插件自定义打包规则

引入 assembly 插件

<plugin>
	<groupId>
		org.apache.maven.plugins
	</groupId>
	<artifactId>
		maven-assembly-plugin
	</artifactId>
	<configuration>
		<descriptors>
			<descriptor>
				src/assembly/src.xml
			</descriptor>
		</descriptors>
	</configuration>
	<executions>
		<execution>
			<phase>
				package
			</phase>
			<goals>
				<goal>
					single
				</goal>
			</goals>
		</execution>
	</executions>
</plugin>

配置打包规则的文件 src.xml

<assembly>
    <id>${assembly-id}</id>
    <!-- 打包成文件夹 -->
    <formats>
        <format>dir</format>
    </formats>
	<includeBaseDirectory>
	false
	</includeBaseDirectory>
	<!--将依赖打包到 lib 目录下-->
    <dependencySets>
    	<dependency>
    		<outputDirectory>
    		lib
    		</outputDirectory>
    		<!--依赖的作用域-->
    		<scope>
    		compile
    		</scope>
    	</dependency>
    </dependencySets>
</assembly>

Assembly

发布了41 篇原创文章 · 获赞 0 · 访问量 783

猜你喜欢

转载自blog.csdn.net/weixin_37562241/article/details/104671486