2017-12-20 7 views
0

은 내가 gradle.build 파일을 설정하려고 시도하고 난 다음 이적 의존성에 문제가 오전 :Gradle에서 부정확 한 메타 데이터로 전이 의존성을 적절하게 끌어 내리는 방법은 무엇입니까?

org.glassfish.ha:ha-api:3.1.8합니다.

pom.xml은 바이너리가 "jar"형식으로되어 있기 때문에 바이너리가 "hk2-jar"형식임을 나타내며 실제로 부정확합니다. 약간의 연구를 수행 한 후 나는 다음 건너 온 :

How should gradle handle “hk2-jar” dependencies?

불행하게도,이 작동하지 않았다.

configurations.all { 
    resolutionStrategy.force 'org.glassfish.ha:ha-api:[email protected]' 
} 

이 유사 잘못된 결과 생산 : 문서를 통해 더 많은 비트를 읽고 나는 단순히과 같이 뭔가를 할 수 있어야 발견 당신이 볼 수 있듯이

Attempts to pull from the wrong URL

를, 그것은에 시도

http://repo-url/org/glassfish/ha/[email protected]/[email protected]

사람이 어떻게 어떤 생각을 가지고 있습니까 : 실제로 다음 URL을 아래로 당겨 제대로 올바른 바이너리를 가져올 수 있으며 잘못된 종속성을 제외 할 수 있습니까?

감사합니다.

그냥 내가 발생 원래 문제가 Gradle을 우리 내부 Artifactory에서 HA-API 의존성을 다운로드하려고 시도 할 때 hk2-jar 파일은 마찬가지로, (403)가 반환된다는 사실이 있음을 추가하고 싶었 EDIT 우리의 저장소 내에 존재하지 (단지 항아리 않습니다) :

* What went wrong: 
Could not resolve all dependencies for configuration ':compileClasspath'. 
> Could not determine artifacts for org.glassfish.ha:ha-api:3.1.8 
    > Could not get resource 'http://repo-url/artifactory/libs-release/org/glassfish/ha/ha-api/3.1.8/ha-api-3.1.8.hk2-jar'. 
     > Could not HEAD 'http://repo-url/artifactory/libs-release/org/glassfish/ha/ha-api/3.1.8/ha-api-3.1.8.hk2-jar'. Received status code 403 from server: Forbidden 
+0

@tkruse, 나는 원래 문제를 포함 시켰습니다. – slashp

답변

0

이 어떤 이유로, (안 받는다는 중앙/jcenter) Artifactory를 사용할 때 주로 문제가 될 것으로 보인다. 위의 작업을 수행 할 필요가 없습니다 (라이브러리 프로젝트에이에 따라 너무 다른 프로젝트를 이행 종속성을 변경

configurations.all { 
    resolutionStrategy.dependencySubstitution { 
     all { DependencySubstitution dependency -> 
     def requested = dependency.requested 
     if (requested instanceof ModuleComponentSelector && requested.group == 'org.glassfish.ha' && requested.name == 'ha-api') { 
      dependency.useTarget "org.glassfish.ha:ha-ap:${requested.version}@jar" 
     } 
     } 
    } 
} 

:

솔루션은 하나 개의 프로젝트에 종속성을 사용하기 위해 Gradle forums

에 설명) :이 또한 Artifactory에서 수행 할 수 있는지 확인하는 가치가있을 수도 있습니다

publications { 
    foo(MavenPublication) { 
     pom.withXml { 
      def dependency = asNode().dependencies.dependency.find { 
       it.groupId.text() == 'org.glassfish.ha' && it.artifactId.text() == 'ha-api') 
      } 
      dependency.appendNode('type', 'jar')  
     } 
    } 
} 

.