You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/07/29 10:59:04 UTC

(maven-ear-plugin) 01/01: Fix: persist manifest unchanged when skipClassPathModification is true

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch fix-skipClassPathModification-539
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git

commit 938edb661d092e694c487ea3cf6ac266365db854
Author: opencode <op...@localhost>
AuthorDate: Wed Jul 29 10:57:00 2026 +0000

    Fix: persist manifest unchanged when skipClassPathModification is true
---
 .../java/org/apache/maven/plugins/ear/EarMojo.java | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
index 992c792..cbf4df3 100644
--- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
@@ -800,20 +800,20 @@ public class EarMojo extends AbstractEarMojo {
 
                 classPath.setValue(StringUtils.join(classPathElements.iterator(), " "));
                 mf.getMainSection().addConfiguredAttribute(classPath);
+            }
 
-                // Write the manifest to disk, preserve timestamp
-                FileTime lastModifiedTime = Files.getLastModifiedTime(manifestFile);
-                try (BufferedWriter writer = Files.newBufferedWriter(
-                        manifestFile,
-                        StandardCharsets.UTF_8,
-                        StandardOpenOption.WRITE,
-                        StandardOpenOption.CREATE,
-                        StandardOpenOption.TRUNCATE_EXISTING)) {
-                    mf.write(writer);
-                }
-                Files.setLastModifiedTime(manifestFile, lastModifiedTime);
-                removeFromOutdatedResources(manifestFile, outdatedResources);
+            // Write the manifest to disk, preserve timestamp
+            FileTime lastModifiedTime = Files.getLastModifiedTime(manifestFile);
+            try (BufferedWriter writer = Files.newBufferedWriter(
+                    manifestFile,
+                    StandardCharsets.UTF_8,
+                    StandardOpenOption.WRITE,
+                    StandardOpenOption.CREATE,
+                    StandardOpenOption.TRUNCATE_EXISTING)) {
+                mf.write(writer);
             }
+            Files.setLastModifiedTime(manifestFile, lastModifiedTime);
+            removeFromOutdatedResources(manifestFile, outdatedResources);
 
             if (fileSystem != null) {
                 fileSystem.close();