在包阶段创建zip文件

时间:2013-04-29 05:20:56

标签: maven maven-assembly-plugin

对于通过maven创建zip文件我遵循:Creating a zip archive of the maven "target" directory我正在使用这个maven命令 assembly:single

是否可以仅在阶段创建zip文件(表示使用清洁包)?

1 个答案:

答案 0 :(得分:1)

请尝试在<plugins>之后添加<pluginManagement>,如下例所示: -

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.4</version>
      <configuration>
        <descriptors>
          <descriptor>src/main/assembly/zip.xml</descriptor>
        </descriptors>
      </configuration>
      <executions>
        <execution>
          <id>make-assembly</id> <!-- this is used for inheritance merges -->
          <phase>package</phase> <!-- append to the packaging phase. -->
          <goals>
            <goal>single</goal> <!-- goals == mojos -->
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</pluginManagement>
<plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
    </plugin>
</plugins>

有关详细信息,请参阅POM Reference: Plugin Management。我希望这可能有所帮助。