2014-12-04 3 views

답변

0

이 같은 프로젝트의 종속성을 액세스 할 수 있습니다

configurations.compile.allDependencies 거기에서 당신은 DependencySet를 반복하고 당신이해야 할 일을 할 수 있습니다.

참고 : afterEvaluate 클로저에서 종속성이 구성 될 때까지이 작업이 필요할 수 있습니다. 그래서 이런 식으로 :

project.afterEvaluate { 
    def dependencySet = configurations.compile.allDependencies 
    def dependenciesSize = dependencySet.size() 
    for (int i = 0; i < dependenciesSize; i++) { 
     def dependency = dependencySet.getAt(i) 
     if (dependency.group != null && dependency.name != null) { 
      if (dependency.group.equals("com.project.group") && 
        dependency.name.equals("my-project")) { 
       // Do what you need to do with the dependency you found. 
      } 
     } 
    } 
} 
관련 문제