Use MAVEN to package a Web project by default, but there are times when you always want to make a zip package (or other compressed package), and the Maven-war-plugin plugin is powerless, and then you use the Maven-assembly-plugin plugin, Official website:
http://maven.apache.org/plugins/maven-assembly-plugin/
The plug-in can be packaged into a specified format distribution, and more importantly, it is possible to customize the inclusion/exclusion of specified directories or files (in legacy projects, when filtering the configuration file, or simply by publishing a picture or a css/js file of the specified type).
The plug-in is used as follows:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactid>maven-assembly- plugin</artifactid> <version>2.4</version> <configuration> <APPENDASSEMBL Yid>false</appendassemblyid> <descriptors> <DESCRIPTOR>${BASEDIR}/ASSEMBLY.XM L</descriptor> <!--Assembly Descriptor file--> <!--<descriptor>src/main/assembly/assembly.xml& Lt;/descriptor>--> </descriptors> </configuration> <executions> &
Lt;execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </executi On> </executions> </plugin>
If shown, bind to the package phase, automatically package, and you need to specify a assembly descriptor file that specifies the packaging format, file/filtered files, and so on, and can be assigned multiple descriptor files, packaged into different formats;
The following is the contents of the Assembly.xml file, which indicates that all files under the Web-inf/lib directory are excluded when packaged:
<assembly xmlns= "http://maven.apache.org/POM/4.0.0"
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance "
xsi:schemalocation=" http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/assembly-1.0.0.xsd ">
<id>full</id>
<formats>
<format>zip</format> <!--packaged file format-- >
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<filesets >
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>webroot </directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>WEB-INF/lib/*</exclude>
</excludes>
</fileset >
</fileSets>
</assembly>
So you can.