如何在maven中创建zip目标而不是jar? [英] How to create zip target instead of jar in maven?
本文介绍了如何在maven中创建zip目标而不是jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮我创建一个拉链目标而不是maven中的jar。我尝试了几种方法,但无法进步。给定路径中的描述符文件如下:
Can someone please help me in creating a zip target instead of jar in maven. I tried several ways but couldn't progress. Given descriptor file in the assembly path is as follows:
<assembly>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>src/main</directory>
</fileSet>
</fileSets>
</assembly>
我的pom文件中的程序集插件部分如下:
The assembly plugin section in my pom file is as follows:
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/descriptor.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
最终输出:
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ sql1 ---
[INFO] Building jar: C:\Divakar\mvn_project\sql1\target\sql1-0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
推荐答案
您需要将插件绑定到特定的生命周期阶段通过执行如下:
You need to bind the plugin to a particular life cylce phase via execution like this:
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
之后你可以通过 mvn clean package
。
这篇关于如何在maven中创建zip目标而不是jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文