class DefaultArtifactManager implements ArtifactManager {

    @Nonnull
    private final InternalMavenSession session;

    private final Map<String, Path> paths = new ConcurrentHashMap<>();

    @Inject
    public DefaultArtifactManager(@Nonnull InternalMavenSession session) {
        this.session = session;
    }

    @Nonnull
    @Override
    public Optional<Path> getPath(@Nonnull Artifact artifact) {
        String id = id(nonNull(artifact, "artifact"));
        if (session.getMavenSession().getAllProjects() != null) {
            for (MavenProject project : session.getMavenSession().getAllProjects()) {
                if (id.equals(id(project.getArtifact()))
                        && project.getArtifact().getFile() != null) {
                    return Optional.of(project.getArtifact().getFile().toPath());
                }
            }
        }
        Path path = paths.get(id);
        if (path == null && artifact instanceof DefaultArtifact) {
            File file = ((DefaultArtifact) artifact).getArtifact().getFile();
            if (file != null) {
                path = file.toPath();
            }
        }
        return Optional.ofNullable(path);
    }

    @Override
    public void setPath(@Nonnull Artifact artifact, Path path) {<FILL_FUNCTION_BODY>}

    /**
     * Retrieve a stream of the project's artifacts.
     * Do not include the POM artifact as the file can't be set anyway.
     */
    private Stream<org.apache.maven.artifact.Artifact> getProjectArtifacts(MavenProject project) {
        return Stream.concat(Stream.of(project.getArtifact()), project.getAttachedArtifacts().stream());
    }

    private String id(org.apache.maven.artifact.Artifact artifact) {
        return artifact.getGroupId()
                + ":" + artifact.getArtifactId()
                + ":" + artifact.getArtifactHandler().getExtension()
                + (artifact.getClassifier() == null || artifact.getClassifier().isEmpty()
                        ? ""
                        : ":" + artifact.getClassifier())
                + ":" + artifact.getVersion();
    }

    private String id(Artifact artifact) {
        return artifact.key();
    }
}

        String id = id(nonNull(artifact, "artifact"));
        if (session.getMavenSession().getAllProjects() != null) {
            session.getMavenSession().getAllProjects().stream()
                    .flatMap(this::getProjectArtifacts)
                    .filter(a -> Objects.equals(id, id(a)))
                    .forEach(a -> a.setFile(path != null ? path.toFile() : null));
        }
        if (path == null) {
            paths.remove(id);
        } else {
            paths.put(id, path);
        }
    
<no_super_class>