这是maven WAR插件的插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<archiveClasses>true</archiveClasses>
<webResources>
<!-- in order to interpolate version from pom into appengine-web.xml -->
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
哪个插件可以生成包含WAR中相同文件的ZIP文件?
答案 0 :(得分:1)
可能的解决方案是使用https://rtcmulticonnection.herokuapp.com/demos/Screen-Sharing.html创建自定义assembly。
以下描述符声明格式为zip
的程序集。它使用<dependencySet>
来声明对Maven构建包装的WAR的依赖性。解压缩此WAR,以便最终ZIP具有与WAR文件完全相同的内容。
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<includes>
<include>${project.groupId}:${project.artifactId}:war:${project.version}</include>
</includes>
<unpack>true</unpack>
</dependencySet>
</dependencySets>
</assembly>
将此文件maven-assembly-plugin
保存在src/assembly/assembly.xml
中。然后,在您的POM中,您需要声明此插件的执行:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
当您使用mvn clean install
调用Maven时,此插件将被执行,它将在target
文件夹中创建所需的ZIP文件。