2012-11-30 2 views
0

그냥 gradle을 사용하기 시작했지만 멀지는 않았습니다. 도와주세요.Gradle - Java 프로젝트의 여러 종속성

필자는 설명서를 따라 갔지만 작동하지 않는 단일 종속성 또는 종속성만을 보여줍니다.

FAILURE: Build failed with an exception. 

* Where: 
Build file 'C:\Dev\Code\officedb\manpower\build.gradle' line: 10 

* What went wrong: 
A problem occurred evaluating root project 'manpower'. 
> Could not create a dependency using notation: {group=org.hibernate:hibernate-validator:5.0.0.Alpha1} 

그러나이 괜찮을 문서를보고 : 내가 얻을 명령 행에 gradle build에 입력 할 때

apply plugin: 'java' 
sourceCompatibility = 1.7 
OFFICEDB_VERSION = 'JAN12R2' 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile group: 
      'org.hibernate:hibernate-validator:5.0.0.Alpha1', 
      'javax.validation:validation-api:1.1.0.Alpha1', 
      'com.exlogs.officedb:common:${OFFICEDB_VERSION}', 
      'com.exlogs.officedb:officedb-service:${OFFICEDB_VERSION}', 
      'com.exlogs:eventhub:1.0.0-RC1', 
      'commons-httpclient:commons-httpclient:3.1' 

testCompile group: 'junit', name: 'junit', version: '4.+' 
} 

문제는 : 여기 내 build.gradle 파일입니다. 또한 찾은 예제 빌드 파일은 모두 작거나 단일 종속성 만 있습니다. 대형 상용 프로젝트에서 gradle을 사용하는 것에 대한 의견이있는 사람이 있습니까?

감사 아담

답변

4

각 의존성 (메이븐 범위, 즉 compile, testCompile 등 유사) 구성을 지정해야합니다

dependencies { 
    compile 'org.hibernate:hibernate-validator:5.0.0.Alpha1' 
    compile 'javax.validation:validation-api:1.1.0.Alpha1' 
    compile "com.exlogs.officedb:common:${OFFICEDB_VERSION}" 
    compile "com.exlogs.officedb:officedb-service:${OFFICEDB_VERSION}" 
    compile 'com.exlogs:eventhub:1.0.0-RC1' 
    compile 'commons-httpclient:commons-httpclient:3.1' 

    testCompile group: 'junit', name: 'junit', version: '4.+' 
    testCompile 'org.mockito:mockito-all:1.9.0' 
} 

group 종속성을 제공하기 위해 대체 문법의 일부입니다 좌표 (group: 'junit', name: 'junit', version: '4.+')가 아니라 특수 키워드입니다.

또한 당신이 문자열에 변수를 사용하는 따옴표가 필요합니다 참고 : 당신이 도움을

compile "com.exlogs.officedb:common:${OFFICEDB_VERSION}" 
+0

감사합니다,하지만 난 아직도 모든 종속성을 확인할 수 없습니다'얻을 일을 얻을려고 몇 시간을 소비 한 후 for configuration : : compile '.'비록 내가 작동하는 build.xml 파일로부터 바로 종속성을 해제 했음에도 불구하고. 명확한 문서의 부족을 감안할 때 나는 gradle이 메인 스트림에 대한 준비가되어 있다고 생각하지 않는다. Maven으로 돌아가는 것은 좋지는 않지만, 실제로 작동하며 문서는 포괄적이고 잘 설명되어 있습니다. –

+0

안녕하세요 Adam, Gradle은 큰 미션 크리티컬 환경에서 사용되며 userguide는 300 페이지가 넘습니다. 여기에서 당신의 주장을 이해할 수 없습니다. "-i"옵션을 사용하여 빌드를 실행하는 스택 추적을 게시 할 수 있습니까? 아마도 빌드가 실패하는 이유를 알아낼 수 있습니다. –

+0

감사합니다. Rene, 게시 하겠지만 월요일 GMT까지 기다려야합니다. –

관련 문제