Sunil Rk
Sunil Rk

Reputation: 1029

Creating zip file in package phase

For Creating the zip file through maven i followed this : Creating a zip archive of the maven "target" directory and i am using this maven command assembly:single .

Is it possible to create zip file in the Package phase only(means using Clean package) ??

Upvotes: 0

Views: 3588

Answers (1)

Charlee Chitsuk
Charlee Chitsuk

Reputation: 9059

Please try to add the <plugins> after the <pluginManagement> as the following example: -

<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>

Please see POM Reference: Plugin Management for further information. I hope this may help.

Upvotes: 1

Related Questions