private boolean hasTheSamePathAsTarget()

in src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java [379:396]


    private boolean hasTheSamePathAsTarget(Artifact artifact, RepositorySystemSession systemSession) {
        try {
            LocalRepositoryManager lrm = systemSession.getLocalRepositoryManager();
            File targetBasedir = lrm.getRepository().getBasedir();
            if (targetBasedir == null) {
                return false;
            }
            File targetFile = new File(targetBasedir, lrm.getPathForLocalArtifact(artifact)).getCanonicalFile();
            File sourceFile = artifact.getFile().getCanonicalFile();
            if (Objects.equals(targetFile, sourceFile)) {
                getLog().debug("Skip install the same target " + sourceFile);
                return true;
            }
            return false;
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }