如何让Maven进行战争:爆炸,但没有战争:战争 [英] How to get Maven to run war:exploded but not war:war
问题描述
我有一个使用<packaging>war</packaging>
的Maven pom.但是实际上,我不想构建war文件,只希望收集所有依赖的jar并创建完整的部署目录.
I have a Maven pom that uses <packaging>war</packaging>
. But actually, I don't want build the war-file, I just want all the dependent jars collected and a full deployment directory created.
所以我正在运行war:exploded
目标以生成部署目录:
So I'm running the war:exploded
goal to generate the deploy directory:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<webappDirectory>target/${env}/deploy</webappDirectory>
<archiveClasses>true</archiveClasses>
</configuration>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
</plugin>
麻烦的是,war文件仍然被构建.有没有一种简单的方法让<packaging>war</packaging>
执行war:exploded
目标而不是war:war目标?
The trouble is, the war file still gets built. Is there a simple way of having <packaging>war</packaging>
execute the war:exploded
goal instead of the war:war goal?
还是有另一种简单的方法可以做到这一点?
Or is there another simple way to do this?
推荐答案
According builtin lifecycle bindings for war packaging in package phase war:war mojo is called.
您可以调用上一个准备包装"阶段-所有操作都将执行,然后调用mojo war:exploded
You can call previous 'prepare-package' phase - all actions will be performed and after that call mojo war:exploded
mvn prepare-package war:exploded
结果将与您的相同,但不会产生战争.
The results will be the same as yours but no war created.
这篇关于如何让Maven进行战争:爆炸,但没有战争:战争的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!