2013-12-23 66 views
0

我們正在嘗試設置多項目構建。Gradle - 多項目編譯但未找到共享項目類

我們有2個項目:

1)PlayerManager 2)共享

我們的項目編譯,當我們運行gradle.test任務

問題是,當我們試圖測試成功在eclipse中運行tomcat上的項目,我們得到了共享項目中所有文件的class not found錯誤。

這裏是我們的gradle.build文件:

PlayerManager(根)

======================= 

apply plugin: 'war' 
apply plugin: 'jetty' 
apply plugin: 'eclipse-wtp' 
apply plugin: 'eclipse' 
apply from: 'dependencies.gradle' 
apply from: 'xmlHandler.gradle' 
apply plugin: 'base' 

dependsOn(":NGShared:NGShared") 

task wrapper(type: Wrapper) { 
gradleVersion = '1.9' 
} 

repositories { 
mavenCentral() 
} 

dependencies { 
providedCompile 'javax.servlet:servlet-api:2.5' 
compile 'org.springframework:spring-webmvc:3.2.2.RELEASE' 
runtime 'javax.servlet:jstl:1.1.2' 
} 

/* Change context path (base url). otherwise defaults to name of project */ 
jettyRunWar.contextPath = '' 

task cleanAndBuild(dependsOn: ['clean', 'assemble']) 

assemble.mustRunAfter clean 

tasks.withType(Test) { 
testLogging { 
events 'passed' 
} 
} 

task testSanity(type: Test, dependsOn: testClasses) { 
exclude '*/TimeBaseTest*' 
} 

共享(子項目)

======================= 

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply from: 'dependencies.gradle' 

task wrapper(type: Wrapper) { 
gradleVersion = '1.9' 
} 

settings.gradle

include ":NGShared:NGShared" 

====================================================== 

Our path for the project is: 

/NGPlayerManager/ 
/NGPlayerManager/NGShared/NGShared 

任何想法爲什麼?

感謝

回答

0

你有沒有嘗試運行「gradle這個eclipseClean」,然後「gradle這個月食」爲了gradle這個再生所有內部月食配置文件?如果你不這樣做,Eclipse將不會自動重新生成它的配置,並且不會將你的子項目包含到.ear或.war包中。

+0

是的,沒有工作 – Urbanleg

+0

我想我明白了!修改'dependsOn(「:NGShared:NGShared」)' '依賴關係{/ *其餘依賴關係... */ compile project(':NGShared:NGShared') } –