maven打包web项目为zip

1、pom.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"> 
    <id>${project.version}</id> 
    <formats> 
        <format>zip</format> 
    </formats> 
    <fileSets>  
        <fileSet> 
            <directory>${project.basedir}\target\${project.artifactId}</directory> 
            <outputDirectory>\${project.artifactId}</outputDirectory> 
        </fileSet>       
        <fileSet> 
            <directory>${project.basedir}\src\main</directory>
            <includes> 
                 <include>scripts</include> 
                 <include>manual</include>
            </includes>
            <outputDirectory>\</outputDirectory> 
        </fileSet>   
    </fileSets> 
 
</assembly>

2、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"> 
    <id>${project.version}</id> 
    <formats> 
        <format>zip</format> 
    </formats> 
    <fileSets>  
        <fileSet> 
            <directory>${project.basedir}\target\${project.artifactId}</directory> 
            <outputDirectory>\${project.artifactId}</outputDirectory> 
        </fileSet>       
        <fileSet> 
            <directory>${project.basedir}\src\main</directory>
            <includes> 
                 <include>scripts</include> 
                 <include>manual</include>
            </includes>
            <outputDirectory>\</outputDirectory> 
        </fileSet>   
    </fileSets> 
 
</assembly>

相关推荐