The package
phase of a project with packaging war
, prepares an exploded-war in the target
folder and packages this into the final war
-file.
Is it possible to make some changes, editing files, removing files and so on, between prepare-package
and package
phases? I'm searching for an extension point (Maven execution-phase
) where the resources are already copied and in the exploded-war structure.
target/{finalName}
. maven-antrun
). war
.I thought this could be possible between the phases prepare-package
and package
. Unfortunately after the prepare-package
no exploded war is available to be changed and packaged later.
Can you give me a hint how to achieve this? Thank you very much.
There are three built-in build lifecycles: default, clean and site. The default lifecycle handles your project deployment, the clean lifecycle handles project cleaning, while the site lifecycle handles the creation of your project's web site.
The clean and package arguments are build phases while the dependency:copy-dependencies is a goal. Here the clean phase will be executed first, followed by the dependency:copy-dependencies goal, and finally package phase will be executed.
Maven Lifecycle: Below is a representation of the default Maven lifecycle and its 8 steps: Validate, Compile, Test, Package, Integration test, Verify, Install and Deploy.
An <execution> causes the plugin to be executed during the maven build lifecycle, i.e. during your build. The <configuration> allows you to configure the plugin for how it should behave during execution. Many Maven plugins provide documentation about their configuration options, e.g. the maven-compiler-plugin.
This configuration calls the exploded
goal in the prepare-package
phase. This gives you the chance to work on the exploded war directory in subsequent plugin definitions e.g. maven-antrun
.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>prepare-war</id>
<phase>prepare-package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With