Artifact (@Nullable Dependency dependency) { if (dependency == null) { return null; } Artifact result = RepositoryUtils.toArtifact(dependency.getArtifact()); if(result == null) { return null; } result.setScope(dependency.getScope()); result.setOptional(dependency.isOptional()); return result; }