Skip to content

Commit

Permalink
Workaround for #179 - skip checksums for deployed metadata
Browse files Browse the repository at this point in the history
We can now skip checksum for metadata to avoid generating warning
Proper way needs more code refactor
  • Loading branch information
slawekjaranowski committed Oct 9, 2023
1 parent 546c312 commit c516ad7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ assert new File( basedir, '../../hosted-repo/org/mojohaus/mrm/hostedrepo/its/dep
assert new File( basedir, '../../hosted-repo/org/mojohaus/mrm/hostedrepo/its/deploy/1.0.0/deploy-1.0.0.pom').exists()
assert new File( basedir, '../../hosted-repo/org/mojohaus/mrm/hostedrepo/its/deploy/1.0.0/deploy-1.0.0.pom.md5').exists()
assert new File( basedir, '../../hosted-repo/org/mojohaus/mrm/hostedrepo/its/deploy/1.0.0/deploy-1.0.0.pom.sha1').exists()

def logs = new File( basedir, 'build.log').text;
assert !logs.contains('[WARNING] Failed to upload checksum')
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ dir.eachFileMatch(~/deploy-1\.0\.0-\d{8}\.\d{6}-1\.pom/) { path = it.absolutePat
assert path != null : "Could not locate pom based on regular expression"
assert new File(path).exists()
assert new File(path + '.md5').exists()
assert new File(path + '.sha1').exists()
assert new File(path + '.sha1').exists()

def logs = new File( basedir, 'build.log').text;
assert !logs.contains('[WARNING] Failed to upload checksum')
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ public FileEntry put(DirectoryEntry parent, String name, InputStream content) th
return new MetadataFileEntry(this, parent, path, store);
}

if (name.startsWith("maven-metadata.xml") && (name.endsWith(".sha1") || name.endsWith(".md5"))) {
// checksum for metadata ... ignore now
// return something != null
// TODO add support for storing checksum files
// https://github.com/mojohaus/mrm/issues/179
return new MetadataFileEntry(this, parent, path, store);
}

Artifact artifact = getArtifact(parent, name);

if (artifact == null) {
Expand Down

0 comments on commit c516ad7

Please sign in to comment.