Ticket #8 (new 分享)
Maven打包
| Reported by: | qinhongyuan | Owned by: | qinhongyuan |
|---|---|---|---|
| Priority: | major | Milestone: | Maven插件 |
| Component: | Maven教程 | Version: | |
| Keywords: | Maven 打包 assembly | Cc: | qinhongyuan |
| Due Date: | 06/02/2012 |
Description
讲解一下Maven强大插件之一的分发包插件(maven-assembly-plugin)
Change History
comment:2 Changed 14 years ago by qinhongyuan
- 有时候我们需要打一些jar给脚本,当然希望生成的jar会自动完成
- 这个是论坛用户行为分析的一个jar
<?xml version="1.0" encoding="UTF-8"?> <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"> <id>userAnalyse</id> <formats><format>jar</format></formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>${basedir}/target/webapp/WEB-INF/classes</directory> <includes> <include> **/cn/pconline/bbs6/analyse/** </include> <include>**/mongo.properties</include> </includes> <outputDirectory>/</outputDirectory> </fileSet> </fileSets> </assembly>
comment:3 Changed 13 years ago by qinhongyuan
- 源码打包,需要添加这个插件
<plugins> <!-- 要将源码放上去,需要加入这个插件 --> <plugin> <artifactId>maven-source-plugin</artifactId> <version>2.1</version> <configuration> <attach>true</attach> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins>
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)
<?xml version="1.0" encoding="UTF-8"?> <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"> <id>statics</id> <formats><format>zip</format></formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>${basedir}/src/main/webapp/js</directory> <outputDirectory>js</outputDirectory> </fileSet> <fileSet> <directory>${basedir}/src/main/webapp/cache</directory> <outputDirectory>cache</outputDirectory> </fileSet> <fileSet> <directory>${basedir}/src/main/webapp/images</directory> <outputDirectory>images</outputDirectory> </fileSet> </fileSets> </assembly>