Configuration (ProjectDependency projectDependency) { try { return !is4OrBetter ? (Configuration)projectDependency.getClass().getMethod("getProjectConfiguration").invoke(projectDependency) : projectDependency.getDependencyProject().getConfigurations().findByName(projectDependency.getTargetConfiguration() != null ? projectDependency.getTargetConfiguration() : "default"); } catch (Exception e) { throw new RuntimeException(e); } }