Skip to content

Commit

Permalink
Default outdatedCheckPath based on v3.3.1 or v3.3.2+ of maven-war-plu…
Browse files Browse the repository at this point in the history
…gin but delegate to user config if present

Signed-off-by: Scott Kurz <[email protected]>
  • Loading branch information
scottkurz committed Aug 10, 2023
1 parent 83ba8f0 commit 19dc08a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Start a Liberty instance in dev mode. This goal also invokes the `create`, `inst

Starting in version 3.6.1, dev mode invokes the `generate-features` goal when the `generateFeatures` configuration parameter is set to `true`. **This goal modifies the source configuration directory of your application.** See [generate-features](generate-features.md) for details. The default value for the `generateFeatures` parameter is `false`. When auto-generation of features is turned on, dev mode has a runtime dependency on IBM WebSphere Application Server Migration Toolkit for Application Binaries, which is separately licensed under IBM License Agreement for Non-Warranted Programs. For more information, see the [license](https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/wamt).

Additionally, starting in 3.5.2-SNAPSHOT, [resource variable filtering](https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html) and [WAR overlays](https://maven.apache.org/plugins/maven-war-plugin/overlays.html) are supported for loose WAR applications. This is done by automatically detecting appropriate Maven WAR plugin configuration and calling the WAR plugin's `exploded` goal and the Maven Resource plugin's `resource` goal when appropriate. Behavior for updating/deleting resources is delegated via the Maven WAR plugin configuration, including the `outdatedCheckPath` parameter enhanced in plugin version 3.3.2.
Additionally, starting in version 3.5.2, [resource variable filtering](https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html) and [WAR overlays](https://maven.apache.org/plugins/maven-war-plugin/overlays.html) are supported for loose WAR applications. This is done by automatically detecting appropriate Maven WAR plugin configuration and calling the WAR plugin's `exploded` goal and the Maven Resource plugin's `resource` goal when appropriate. Behavior for updating/deleting resources can be configured via the [`outdatedCheckPath`](https://maven.apache.org/plugins/maven-war-plugin/exploded-mojo.html#outdatedCheckPath) parameter introduced and then enhanced in maven-war-plugin versions 3.3.1, 3.3.2.


To start the server in a container, see the [devc](#devc-container-mode) section below.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ protected void installLooseConfigWar(MavenProject proj, LooseConfigData config,

// Validate maven-war-plugin version
Plugin warPlugin = getPlugin("org.apache.maven.plugins", "maven-war-plugin");
if (!validatePluginVersion(warPlugin.getVersion(), "3.3.1")) {
getLog().warn("Exploded WAR functionality is enabled. Please use maven-war-plugin version 3.3.1 or greater for best results.");
if (!validatePluginVersion(warPlugin.getVersion(), "3.3.2")) {
getLog().warn(
"Exploded WAR functionality is enabled. Please use maven-war-plugin version 3.3.2 or greater for best results.");
}

// Don't especially need to run it exactly here, but in debugger we can see what we have
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,9 @@ protected void updateLooseApp() throws PluginExecutionException {

// Validate maven-war-plugin version
Plugin warPlugin = getPlugin("org.apache.maven.plugins", "maven-war-plugin");
if (!validatePluginVersion(warPlugin.getVersion(), "3.3.1")) {
getLog().warn("Exploded WAR functionality is enabled. Please use maven-war-plugin version 3.3.1 or greater for best results.");
if (!validatePluginVersion(warPlugin.getVersion(), "3.3.2")) {
getLog().warn(
"Exploded WAR functionality is enabled. Please use maven-war-plugin version 3.3.2 or greater for best results.");
}

redeployApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,14 @@ protected void runExplodedMojo() throws MojoExecutionException {
Plugin warPlugin = getPlugin("org.apache.maven.plugins", "maven-war-plugin");
Xpp3Dom explodedConfig = ExecuteMojoUtil.getPluginGoalConfig(warPlugin, "exploded", getLog());

if (validatePluginVersion(warPlugin.getVersion(), "3.3.1")) {
explodedConfig.addChild(element(name("outdatedCheckPath"), "WEB-INF").toDom());
if (explodedConfig.getChild("outdatedCheckPath") == null) {
if (validatePluginVersion(warPlugin.getVersion(), "3.3.2")) {
explodedConfig.addChild(element(name("outdatedCheckPath"), "/").toDom());
} else if (validatePluginVersion(warPlugin.getVersion(), "3.3.1")) {
explodedConfig.addChild(element(name("outdatedCheckPath"), "WEB-INF").toDom());
}
}

getLog().info("Running maven-war-plugin:exploded");
getLog().debug("configuration:\n" + explodedConfig);
session.getRequest().setStartTime(new Date());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public class ExecuteMojoUtil {
// https://maven.apache.org/plugins/maven-war-plugin/exploded-mojo.html
private static final ArrayList<String> EXPLODED_PARAMS = new ArrayList<>(Arrays.asList(
"filteringDeploymentDescriptors", "warSourceDirectory", "webappDirectory", "workDirectory", "filters",
"overlays", "webResources"
"outdatedCheckPath", "overlays", "webResources"
));

// https://maven.apache.org/plugins/maven-ear-plugin/ear-mojo.html
Expand Down

0 comments on commit 19dc08a

Please sign in to comment.