[ https://issues.apache.org/jira/browse/MRESOLVER-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17780196#comment-17780196 ]
Tamas Cservenak edited comment on MRESOLVER-392 at 10/27/23 8:20 AM: --------------------------------------------------------------------- Current logic (present in Resolver 1.x): {noformat} boolean copy = "pom".equals(artifact.getExtension()) || srcFile.lastModified() != dstFile.lastModified() || srcFile.length() != dstFile.length() || !srcFile.exists(); {noformat} That is: * POMs are always installed (I guess due subsequent "naive change detection", POMs may be same in size buy contain different data) * some 'naive change detection": timestamp and size compared * ~if source does not exists~ non existent files will yield in copy=true => failure Now, I find all these totally flawed (especially the "change detection"), while the last line I find really weird: there is an install request for non existent file, silently skip it? It was added later to resolver without issue https://github.com/apache/maven-resolver/commit/cc32c97cc72f186acb6fe897ae8bd105ba6980c3 My guess is that there was some Maven2/3 transition issue, something was probably creating install request without backing file (my beer-guess is some sort of Metadata). I am about to change this: * always install * keep the "if missing" logic that is DISABLED by default (so let resolver behave as should), but let users turn on this legacy behaviour, as I guess some legacy code may trigger it (so to not leave users stranded) was (Author: cstamas): Current logic (present in Resolver 1.x): {noformat} boolean copy = "pom".equals(artifact.getExtension()) || srcFile.lastModified() != dstFile.lastModified() || srcFile.length() != dstFile.length() || !srcFile.exists(); {noformat} That is: * POMs are always installed (I guess due subsequent "naive change detection", POMs may be same in size buy contain different data) * some 'naive change detection": timestamp and size compared * if source does not exists Now, I find all these totally flawed (especially the "change detection"), while the last line I find really weird: there is an install request for non existent file, silently skip it? It was added later to resolver without issue https://github.com/apache/maven-resolver/commit/cc32c97cc72f186acb6fe897ae8bd105ba6980c3 My guess is that there was some Maven2/3 transition issue, something was probably creating install request without backing file (my beer-guess is some sort of Metadata). I am about to change this: * always install * keep the "if missing" logic that is DISABLED by default (so let resolver behave as should), but let users turn on this legacy behaviour, as I guess some legacy code may trigger it (so to not leave users stranded) > Resolver installer should not be "smart" about installs > ------------------------------------------------------- > > Key: MRESOLVER-392 > URL: https://issues.apache.org/jira/browse/MRESOLVER-392 > Project: Maven Resolver > Issue Type: Bug > Components: Resolver > Reporter: Tamas Cservenak > Priority: Major > Fix For: 2.0.0 > > > Seems in some cases (equality by timestamp and file size) DefaultInstaller > will NOT install the requested file, and log this fact on DEBUG level. > This is wrong: resolver should NOT be "smart" in this case. IMO, if "install > request" flies it, resolver should install unconditionally. > Or, maybe perform some more checks, and refuse install in case like: > * release artifact that is already present in local repository? -- This message was sent by Atlassian Jira (v8.20.10#820010)