assembly .xml
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> formats> format>zip</> <!-- 设置打包后的格式为zip --> fileSets> 要打包的文件 --> fileSet 根目录下的readme、license、notice文件 --> directory>${project.basedir}> outputDirectory>/includes> include>README*>LICENSE*>NOTICE*> bin目录下的所有文件(批处理文件) >${project.basedir}/bin> target目录下的jar包 >${project.build.directory}/>*.jardependencySets 打包的依赖jar,放置在lib下 dependencySet>/libuseProjectArtifact>falsescope>runtime> assembly>
Pom.xml
project ="http://maven.apache.org/POM/4.0.0" xmlns:xsi xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> modelVersion>4.0.0> artifactId>module-imversion>0.0.1-SNAPSHOTpackaging>jarnameparentgroupId>com.shj>micro-service-parent>1.0.0propertiesproject.build.name>imdependenciesdependency> >interface-im>${ykee.version}buildfinalNamepluginsplugin> >org.apache.maven.plugins>maven-assembly-pluginconfiguration> descriptors> descriptor>assembly.xml 指定assembly配置文件路径 --> executionsexecutionid>make-assemblyphase>packagegoals> goal>single>maven-jar-pluginarchivemanifestaddClasspath>true 增加classpath --> classpathPrefix>lib/ classpath路径前缀 mainClass>com.shj.ms.im.ImApplication 程序主入口类 --> > project>
原文链接:/maven/991875.html