2013-12-23 64 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') } –