public Artifact createDependencyArtifact()

in src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java [728:766]


    public Artifact createDependencyArtifact(Dependency d) {
        VersionRange versionRange;
        try {
            versionRange = VersionRange.createFromVersionSpec(d.getVersion());
        } catch (InvalidVersionSpecificationException e) {
            LOGGER.error(
                    String.format(
                            "Invalid version specification '%s' creating dependency artifact '%s'.", d.getVersion(), d),
                    e);
            // should not happen here ?
            throw new RuntimeException(e);
        }

        Artifact artifact = createArtifact(
                d.getGroupId(),
                d.getArtifactId(),
                versionRange,
                d.getType(),
                d.getClassifier(),
                d.getScope(),
                null,
                d.isOptional());

        if (Artifact.SCOPE_SYSTEM.equals(d.getScope()) && d.getSystemPath() != null) {
            artifact.setFile(new File(d.getSystemPath()));
        }

        if (!d.getExclusions().isEmpty()) {
            List<String> exclusions = new ArrayList<>();

            for (Exclusion exclusion : d.getExclusions()) {
                exclusions.add(exclusion.getGroupId() + ':' + exclusion.getArtifactId());
            }

            artifact.setDependencyFilter(new ExcludesArtifactFilter(exclusions));
        }

        return artifact;
    }