class TransformedArtifact extends DefaultArtifact {

    private static final int SHA1_BUFFER_SIZE = 8192;
    private final DefaultConsumerPomArtifactTransformer defaultConsumerPomArtifactTransformer;
    private final MavenProject project;
    private final Supplier<Path> sourcePathProvider;
    private final Path target;
    private final RepositorySystemSession session;
    private final AtomicReference<String> sourceState;

    TransformedArtifact(
            DefaultConsumerPomArtifactTransformer defaultConsumerPomArtifactTransformer,
            MavenProject project,
            Path target,
            RepositorySystemSession session,
            org.apache.maven.artifact.Artifact source,
            Supplier<Path> sourcePathProvider,
            String classifier,
            String extension) {
        super(
                source.getGroupId(),
                source.getArtifactId(),
                source.getVersionRange(),
                source.getScope(),
                extension,
                classifier,
                new TransformedArtifactHandler(
                        classifier, extension, source.getArtifactHandler().getPackaging()));
        this.defaultConsumerPomArtifactTransformer = defaultConsumerPomArtifactTransformer;
        this.project = project;
        this.target = target;
        this.session = session;
        this.sourcePathProvider = sourcePathProvider;
        this.sourceState = new AtomicReference<>(null);
    }

    @Override
    public boolean isResolved() {
        return getFile() != null;
    }

    @Override
    public void setFile(File file) {
        throw new UnsupportedOperationException("transformed artifact file cannot be set");
    }

    @Override
    public synchronized File getFile() {
        try {
            String state = mayUpdate();
            if (state == null) {
                return null;
            }
            return target.toFile();
        } catch (IOException | NoSuchAlgorithmException | XMLStreamException | ModelBuildingException e) {
            throw new TransformationFailedException(e);
        }
    }

    private String mayUpdate()
            throws IOException, NoSuchAlgorithmException, XMLStreamException, ModelBuildingException {<FILL_FUNCTION_BODY>}

    static String sha1(Path path) throws NoSuchAlgorithmException, IOException {
        MessageDigest md = MessageDigest.getInstance("SHA-1");
        try (InputStream fis = Files.newInputStream(path)) {
            byte[] buffer = new byte[SHA1_BUFFER_SIZE];
            int read;
            while ((read = fis.read(buffer)) != -1) {
                md.update(buffer, 0, read);
            }
        }
        StringBuilder result = new StringBuilder();
        for (byte b : md.digest()) {
            result.append(String.format("%02x", b));
        }
        return result.toString();
    }
}

        String result;
        Path src = sourcePathProvider.get();
        if (src == null) {
            Files.deleteIfExists(target);
            result = null;
        } else if (!Files.exists(src)) {
            Files.deleteIfExists(target);
            result = "";
        } else {
            String current = sha1(src);
            String existing = sourceState.get();
            if (!Objects.equals(current, existing)) {
                defaultConsumerPomArtifactTransformer.transform(project, session, src, target);
                Files.setLastModifiedTime(target, Files.getLastModifiedTime(src));
            }
            result = current;
        }
        sourceState.set(result);
        return result;
    
<methods>public void <init>(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.apache.maven.artifact.handler.ArtifactHandler) ,public void <init>(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.apache.maven.artifact.handler.ArtifactHandler, boolean) ,public void <init>(java.lang.String, java.lang.String, org.apache.maven.artifact.versioning.VersionRange, java.lang.String, java.lang.String, java.lang.String, org.apache.maven.artifact.handler.ArtifactHandler) ,public void <init>(java.lang.String, java.lang.String, org.apache.maven.artifact.versioning.VersionRange, java.lang.String, java.lang.String, java.lang.String, org.apache.maven.artifact.handler.ArtifactHandler, boolean) ,public void addMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata) ,public int compareTo(org.apache.maven.artifact.Artifact) ,public boolean equals(java.lang.Object) ,public org.apache.maven.artifact.handler.ArtifactHandler getArtifactHandler() ,public java.lang.String getArtifactId() ,public List<org.apache.maven.artifact.versioning.ArtifactVersion> getAvailableVersions() ,public java.lang.String getBaseVersion() ,public java.lang.String getClassifier() ,public java.lang.String getDependencyConflictId() ,public org.apache.maven.artifact.resolver.filter.ArtifactFilter getDependencyFilter() ,public List<java.lang.String> getDependencyTrail() ,public java.lang.String getDownloadUrl() ,public java.io.File getFile() ,public java.lang.String getGroupId() ,public java.lang.String getId() ,public Collection<org.apache.maven.artifact.metadata.ArtifactMetadata> getMetadataList() ,public org.apache.maven.artifact.repository.ArtifactRepository getRepository() ,public java.lang.String getScope() ,public org.apache.maven.artifact.versioning.ArtifactVersion getSelectedVersion() throws org.apache.maven.artifact.versioning.OverConstrainedVersionException,public java.lang.String getType() ,public java.lang.String getVersion() ,public org.apache.maven.artifact.versioning.VersionRange getVersionRange() ,public boolean hasClassifier() ,public int hashCode() ,public boolean isOptional() ,public boolean isRelease() ,public boolean isResolved() ,public boolean isSelectedVersionKnown() throws org.apache.maven.artifact.versioning.OverConstrainedVersionException,public boolean isSnapshot() ,public void selectVersion(java.lang.String) ,public void setArtifactHandler(org.apache.maven.artifact.handler.ArtifactHandler) ,public void setArtifactId(java.lang.String) ,public void setAvailableVersions(List<org.apache.maven.artifact.versioning.ArtifactVersion>) ,public void setBaseVersion(java.lang.String) ,public void setDependencyFilter(org.apache.maven.artifact.resolver.filter.ArtifactFilter) ,public void setDependencyTrail(List<java.lang.String>) ,public void setDownloadUrl(java.lang.String) ,public void setFile(java.io.File) ,public void setGroupId(java.lang.String) ,public void setOptional(boolean) ,public void setRelease(boolean) ,public void setRepository(org.apache.maven.artifact.repository.ArtifactRepository) ,public void setResolved(boolean) ,public void setResolvedVersion(java.lang.String) ,public void setScope(java.lang.String) ,public void setVersion(java.lang.String) ,public void setVersionRange(org.apache.maven.artifact.versioning.VersionRange) ,public java.lang.String toString() ,public void updateVersion(java.lang.String, org.apache.maven.artifact.repository.ArtifactRepository) <variables>private org.apache.maven.artifact.handler.ArtifactHandler artifactHandler,private java.lang.String artifactId,private List<org.apache.maven.artifact.versioning.ArtifactVersion> availableVersions,private java.lang.String baseVersion,private final non-sealed java.lang.String classifier,private org.apache.maven.artifact.resolver.filter.ArtifactFilter dependencyFilter,private List<java.lang.String> dependencyTrail,private java.lang.String downloadUrl,private volatile java.io.File file,private java.lang.String groupId,private Map<java.lang.Object,org.apache.maven.artifact.metadata.ArtifactMetadata> metadataMap,private boolean optional,private boolean release,private org.apache.maven.artifact.repository.ArtifactRepository repository,private volatile boolean resolved,private volatile java.lang.String scope,private final non-sealed java.lang.String type,private volatile java.lang.String version,private org.apache.maven.artifact.versioning.VersionRange versionRange