private void save(List<ResolvedArtifact> result) {
        Path filePath = location.toPath();
        Path parent = filePath.getParent();
        if (parent == null) {
            throw new DependencyResolverException("Invalid classpath cache location: " + location);
        }

        try {
            Files.createDirectories(parent);
            ObjectNode.Builder builder = Node.objectNodeBuilder();
            builder.withMember("version", CURRENT_CACHE_FILE_VERSION);
            ObjectNode.Builder artifactNodeBuilder = Node.objectNodeBuilder();
            for (ResolvedArtifact artifact : result) {
                artifactNodeBuilder.withMember(artifact.getCoordinates(), artifact.toNode());
            }
            builder.withMember("artifacts", artifactNodeBuilder.build());
            Files.write(filePath, Node.printJson(builder.build()).getBytes(StandardCharsets.UTF_8));
        } catch (IOException e) {
            throw new DependencyResolverException("Unable to write classpath cache file: " + e.getMessage(), e);
        }
    }
@param location The location to the cache.
@param referenceTimeInMillis Invalidate cache items if this time is newer than the cache item time.
@param delegate Resolver to delegate to when dependencies aren't cached.
smithy-cli/src/main/java/software/amazon/smithy/cli/dependencies/FileCacheResolver.java