You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2023/10/27 08:57:22 UTC
(maven-resolver) branch master updated: [MRESOLVER-392] Remove change detection logic on install (#351)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new 72ddff20 [MRESOLVER-392] Remove change detection logic on install (#351)
72ddff20 is described below
commit 72ddff20839628566fab4d67ff1e5684a38ce73e
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri Oct 27 10:57:17 2023 +0200
[MRESOLVER-392] Remove change detection logic on install (#351)
Still, make possible to restore the "skip if missing" as I find no reasonong for it, but my guess is that it may be about some legacy code somewhere, most probably adding Metadata without backing file (as in Maven2 metadata was added by hand).
---
https://issues.apache.org/jira/browse/MRESOLVER-392
---
.../aether/internal/impl/DefaultInstaller.java | 19 ++-----------------
.../aether/internal/impl/DefaultInstallerTest.java | 2 ++
2 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java
index 6f24fc5b..f4c60bf3 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java
@@ -50,8 +50,6 @@ import org.eclipse.aether.repository.LocalMetadataRegistration;
import org.eclipse.aether.repository.LocalRepositoryManager;
import org.eclipse.aether.spi.io.FileProcessor;
import org.eclipse.aether.spi.synccontext.SyncContextFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static java.util.Objects.requireNonNull;
@@ -60,9 +58,6 @@ import static java.util.Objects.requireNonNull;
@Singleton
@Named
public class DefaultInstaller implements Installer {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DefaultInstaller.class);
-
private final FileProcessor fileProcessor;
private final RepositoryEventDispatcher repositoryEventDispatcher;
@@ -179,18 +174,8 @@ public class DefaultInstaller implements Installer {
throw new IllegalStateException("cannot install " + dstFile + " to same path");
}
- boolean copy = "pom".equals(artifact.getExtension())
- || srcFile.lastModified() != dstFile.lastModified()
- || srcFile.length() != dstFile.length()
- || !srcFile.exists();
-
- if (!copy) {
- LOGGER.debug("Skipped re-installing {} to {}, seems unchanged", srcFile, dstFile);
- } else {
- fileProcessor.copy(srcFile, dstFile);
- dstFile.setLastModified(srcFile.lastModified());
- }
-
+ fileProcessor.copy(srcFile, dstFile);
+ dstFile.setLastModified(srcFile.lastModified());
lrm.add(session, new LocalArtifactRegistration(artifact));
} catch (Exception e) {
exception = e;
diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java
index 081dab64..76f15b71 100644
--- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java
+++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java
@@ -40,6 +40,7 @@ import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.metadata.Metadata.Nature;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
@@ -324,6 +325,7 @@ public class DefaultInstallerTest {
}
@Test
+ @Disabled("Naive change detection is removed (MRESOLVER-392)")
void testDoNotUpdateUnchangedArtifact() throws InstallationException {
request.addArtifact(artifact);
installer.install(session, request);