2015-01-29 4 views
0

종속성을 해결하기 위해 프로젝트를 gradle로 마이그레이션하고 Eclipse 프로젝트를 생성 한 다음 프로젝트를 빌드하면 Eclipse 프로젝트의 일부 종속성 버전에 문제가 있습니다. 다음은 프로젝트의 build.gradle입니다. 하위 프로젝트가있는 EAR입니다.종속성에 대한 잘못된 버전을 사용하는 Gradle eclipse

apply plugin: 'ear' 

def eclipseJbossName = 'org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 6.x Runtime' 
def defaultEarConfig = rootDir.getAbsolutePath() + '/ear.gradle' 

allprojects { 
    apply plugin: 'eclipse' 
    apply plugin: 'eclipse-wtp' 
    apply plugin: 'idea' 
    eclipse { 
     classpath { 
      containers eclipseJbossName 
     } 
    } 
    repositories { 
     maven { 
      name = "mvnrepository" 
      url = "http://mvnrepository.com/" 
     } 
     mavenCentral() 
     maven { 
      name = 'jboss' 
      url = 'http://repository.jboss.org/nexus/content/groups/public/' 
     } 
    } 
} 

subprojects { 
    configurations { 
     provided 
    } 
    apply plugin: 'java' 
    sourceCompatibility = 1.6 
    targetCompatibility = 1.6 
    sourceSets { 
     main { 
      compileClasspath += configurations.provided 
      compileClasspath += configurations.compile 
      compileClasspath += configurations.runtime 
     } 
    } 
} 
dependencies { 
    deploy (project(path: 'anEJB')) { 
     transitive = false 
    } 
    deploy (project(path: 'anotherEJB')) { 
     transitive = false 
    } 
    deploy (project(path: 'aWAR', configuration: 'archives')) { 
     transitive = false 
    } 
    earlib ('commons-beanutils:commons-beanutils:1.6') { 
     transitive = false 
    } 
    //lots of other dependencies and all with transitive=false 
} 
//configuration of my subprojects 

내가 gradle ear를 호출 할 때 빌드 올바르게 내 이슈를 생성합니다. EAR의 루트 안에있는 lib 디렉토리에는 모든 earlib에 올바른 버전이 있습니다. gradle cleanEclipse eclipse을 호출하면 프로젝트가 올바르게 생성되지만, 이클립스 내부에서 빌드 경로를 볼 때 잘못된 버전의 공유 beanutils가 사용됩니다. 그것은 버전 1.8을 사용하고 있습니다. 이것은 내 모든 의존성에 대해서는 일어나지 않지만이 문제가있는 다른 것들이 있습니다. 전이 의존성을 해결하지 못하게하려고했습니다.

+0

죄송합니다. 문제는 재현 할 수 없습니다. 어쩌면 당신은 그것을위한 짧은 재생기를 쓸 수 있습니까? Gradle의 어떤 버전을 사용합니까? –

+0

안녕하세요. It 's gradle 2.1 – Augusto

+0

나에게 그것은 Gradle 2.1과 함께 작동한다. .. 미안 ... –

답변

0

Eclipse에서 프로젝트를 마우스 오른쪽 버튼으로 클릭 한 다음 속성을 클릭 할 수 있습니다. 그리고 "Java Build Path"를 선택하고 "Libraries"탭을 클릭하십시오. 마지막으로 "Gradle Dependencies"& "JRE System Libraries"외에 모든 병을 제거하십시오.

완료. 시도 해봐.

관련 문제