michael-o commented on a change in pull request #141: URL: https://github.com/apache/maven-resolver/pull/141#discussion_r795236549
########## File path: maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/FileProvidedChecksumSource.java ########## @@ -0,0 +1,193 @@ +package org.eclipse.aether.internal.impl; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.spi.connector.ArtifactDownload; +import org.eclipse.aether.spi.connector.MetadataDownload; +import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory; +import org.eclipse.aether.spi.connector.checksum.ProvidedChecksumsSource; +import org.eclipse.aether.spi.io.FileProcessor; +import org.eclipse.aether.util.ConfigUtils; +import org.eclipse.aether.util.artifact.ArtifactIdUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static java.util.Objects.requireNonNull; + +/** + * Local filesystem backed {@link ProvidedChecksumsSource} implementation that use specified directory as base + * directory, where it expects artifacts checksums on standard Maven2 "local" layout. This implementation uses Artifact + * (and Metadata) coordinates solely to form path from baseDir (for Metadata file name is + * {@code maven-metadata-local.xml.sha1} in case of SHA-1 checksum). Review comment: there is no checksum for a local file: ``` $ find . -name maven-metadata\*.xml.\* -type f -exec basename {} \; | sort -u maven-metadata-apache.snapshots.https.xml.sha1 maven-metadata-apache.snapshots.xml.sha1 maven-metadata-central-mirror.xml.sha1 maven-metadata-central.xml.sha1 maven-metadata-dynamowerk-public.xml.sha1 maven-metadata-jboss.release.xml.sha1 maven-metadata-lda-public.xml.sha1 maven-metadata-maven-core-it.xml.sha1 maven-metadata-nexus-dynamowerk-berlin.xml.sha1 maven-metadata-nexus-dynamowerk-berlin.xml.sha256 maven-metadata-nexus-dynamowerk-berlin.xml.sha512 maven-metadata-public.xml.sha1 maven-metadata-repository.jboss.org.xml.sha1 maven-metadata-snapshot-repository.xml.sha1 maven-metadata-sonatype-nexus-snapshots.xml.sha1 maven-metadata-sonatype.xml.sha1 maven-metadata-tesla.xml.part maven-metadata-tesla.xml.part.lock ``` and ``` $ find . -name maven-metadata\*.xml -type f -exec basename {} \; | sort -u maven-metadata-apache.snapshots.https.xml maven-metadata-apache.snapshots.xml maven-metadata-central-mirror.xml maven-metadata-central.xml maven-metadata-dynamowerk-public.xml maven-metadata-jboss.release.xml maven-metadata-lda-public.xml maven-metadata-lda-releases.xml maven-metadata-local.xml maven-metadata-maven-core-it.xml maven-metadata-nexus-dynamowerk-berlin.xml maven-metadata-public.xml maven-metadata-remote.xml maven-metadata-repository.jboss.org.xml maven-metadata-snapshot-repository.xml maven-metadata-sonatype-nexus-snapshots.xml maven-metadata-sonatype.xml ``` As far as I understand, the checksum is for a remote repo and the checksum will change as soon as the metadata will change. An artifact is immutable, but the metadata is not. So you will need to update the metadata checksum everytime. I think this does not make sense. I think we should drop this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
