private List<Path> resolveDependencies(
            BuildOptions buildOptions,
            SmithyBuildConfig smithyBuildConfig,
            Command.Env env,
            MavenConfig maven
    ) {
        DependencyResolver baseResolver = dependencyResolverFactory.create(smithyBuildConfig, env);
        long lastModified = smithyBuildConfig.getLastModifiedInMillis();
        DependencyResolver delegate = new FilterCliVersionResolver(SmithyCli.getVersion(), baseResolver);
        DependencyResolver resolver = new FileCacheResolver(getCacheFile(buildOptions, smithyBuildConfig),
                lastModified,
                delegate);

        Set<MavenRepository> repositories = ConfigurationUtils.getConfiguredMavenRepos(smithyBuildConfig);
        repositories.forEach(resolver::addRepository);

        // Use the pinned lockfile dependencies if a lockfile exists otherwise use the configured dependencies
        Optional<LockFile> lockFileOptional = LockFile.load();
        if (lockFileOptional.isPresent()) {
            LockFile lockFile = lockFileOptional.get();
            if (lockFile.getConfigHash() != ConfigurationUtils.configHash(maven.getDependencies(), repositories)) {
                throw new CliError(
                        "`smithy-lock.json` does not match configured dependencies. "
                                + "Re-lock dependencies using the `lock` command or revert changes.");
            }
            LOGGER.fine(() -> "`smithy-lock.json` found. Using locked dependencies: "
                    + lockFile.getDependencyCoordinateSet());
            lockFile.getDependencyCoordinateSet().forEach(resolver::addDependency);
        } else {
            maven.getDependencies().forEach(resolver::addDependency);
        }

        List<ResolvedArtifact> artifacts = resolver.resolve();
        LOGGER.fine(() -> "Classpath resolved with Maven: " + artifacts);

        // Ensure resolved artifacts match pinned artifacts
        lockFileOptional.ifPresent(lockFile -> lockFile.validateArtifacts(artifacts));
        List<Path> result = new ArrayList<>(artifacts.size());
        for (ResolvedArtifact artifact : artifacts) {
            result.add(artifact.getPath());
        }

        return result;
    }
A {@code CommandAction} that runs a wrapped action within a custom classpath.
smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ClasspathAction.java