maven打war包排除文件目录

来源:互联网 发布:数据库用户老是被锁 编辑:程序博客网 时间:2024/06/01 07:44
方案1:
添加插件
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <packagingExcludes>css/**,html/**</packagingExcludes>
    </configuration>
</plugin> 


在<configuration>中添加<packagingExcludes>,多个目录用逗号分隔开。




方案2:
                     <plugin>

                        <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>model-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<packagingExcludes>css/**,html/**</packagingExcludes>
<warName>hip-hesp</warName>
<webResources>
<webResource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<includes>
<include>web.xml</include>
</includes>
<targetPath>WEB-INF</targetPath>
<filtering>true</filtering>
</webResource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>


同样可以进行web工程打包,排除不需要的目录。
0 0