如果百度资料比较少,可以直接查看帮助文档
比如,今天遇到的 【maven-assembly-plugin】
可用生成zip文件。
■可以百度到的内容总结
https://blog.csdn.net/sxzlc/article/details/107529169
http://maven.apache.org/plugins/maven-assembly-plugin/
■帮助文档 【plugin】
点击第一列即可查看
(下面第四张图,Tools 中 黄色背景色标记的部分)
===
===
===
Tools
---
■标签介绍页面
http://maven.apache.org/plugins/maven-assembly-plugin/
↓点击背景色黄色,标记的部分进入
■标签中的各个属性
http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html
assembly.xml
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd"> <id>project</id> <formats> <format>tar.gz</format> <format>tar.bz2</format> <format>zip</format> </formats> <fileSets> <fileSet> <directory>${project.basedir}</directory> <outputDirectory></outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> <excludes> <exclude>**/*.log</exclude> <exclude>**/${project.build.directory}/**</exclude> </excludes> </fileSet> </fileSets> </assembly>
===
pom.xml
<project> <groupId>your.group.id</groupId> <artifactId>my-project</artifactId> <version>1.0-SNAPSHOT</version> <modelVersion>4.0.0</modelVersion> ... <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.3.0</version> <dependencies> <dependency> <groupId>your.group.id</groupId> <artifactId>my-assembly-descriptor</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <fileName>delply</fileName> <!-- This is where we use our shared assembly descriptor --> <descriptorRefs> <descriptorRef>myassembly</descriptorRef> </descriptorRefs> <descriptor>assembly.xml</descriptor> </configuration> </execution> </executions> </plugin> ... </plugins> </build> ... </project>===
http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/filtering-some-distribution-files.html
<project> [...] <build> [...] <plugins> [...] <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.3.0</version> <configuration> <filters> <filter>src/assembly/filter.properties</filter> </filters> <descriptors> <descriptor>src/assembly/distribution.xml</descriptor> </descriptors> </configuration> </plugin> [...] </project>===
The Assembly Descriptor
Filtering is only enabled inside <files> so that's what we will use. Thus, our assembly descriptor will be:
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd"> <id>distribution</id> <formats> <format>jar</format> </formats> <files> <file> <source>README.txt</source> <outputDirectory></outputDirectory> <filtered>true</filtered> </file> <file> <source>LICENSE.txt</source> <outputDirectory></outputDirectory> </file> <file> <source>NOTICE.txt</source> <outputDirectory></outputDirectory> <filtered>true</filtered> </file> </files> </assembly>===
===
The above descriptor tells the Assembly Plugin to filter both the README.txt and the NOTICE.txt files and to just copy the LICENSE.txt file.
Alternatively, if there are many .txt files to include inside <files>, we can setup both <fileSets> and <files> like so:
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd"> <id>distribution</id> <formats> <format>jar</format> </formats> <fileSets> <fileSet> <directory>${basedir}</directory> <includes> <include>*.txt</include> </includes> <excludes> <exclude>README.txt</exclude> <exclude>NOTICE.txt</exclude> </excludes> </fileSet> </fileSets> <files> <file> <source>README.txt</source> <outputDirectory></outputDirectory> <filtered>true</filtered> </file> <file> <source>NOTICE.txt</source> <outputDirectory></outputDirectory> <filtered>true</filtered> </file> </files> </assembly>===
http://www.voidcn.com/article/p-pqqplemi-zk.html