我正在使用 maven-assembly-plugin 创建文件的 zip。要压缩的文件应该来自成功构建后生成的目标文件夹。我希望创建的 zip 文件的输出文件夹位于目标文件夹中生成的 .war 文件中。
所以在完全生成目标文件夹后,插件应该对目标文件夹中生成的文件起作用
这是我的 pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<descriptor>src/main/java/assembly/zipPluginConfig.xml</descriptor>
<finalName>final</finalName>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>target/mavenWebApp-1.0.war/WEB-INF</outputDirectory>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
汇编文件是:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bundle</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>target/classes/com/nani/mavenwebapp</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>