2016-06-28 57 views
-1

我有两个模块,一个项目的IntelliJ:运行gradle这个 “战争” 不包括相关的IntelliJ项目

web-services(我的API),library-services(业务逻辑)。

的build.gradle网络serivces的:

apply plugin: 'java' 
apply plugin: 'war' 
apply plugin: 'maven-publish' 
apply from: ext.gradleDir + '/common.gradle' 
apply from: ext.gradleDir + '/integration_test.gradle' 

sourceCompatibility = 1.8 
targetCompatibility = 1.8 
project.version = '1.0.' + getBuildNumber() 


dependencies { 
    compile project(':library-services') 
    compile('com.waze.automation:common:1.0.80') 

    compile('com.sun.jersey:jersey-bundle:1.19') 
    compile('com.sun.jersey:jersey-json:1.19') 
    compile group: 'org.codehaus.jackson', name:'jackson-jaxrs', version: '1.1.1' 

    compile('com.google.guava:guava:18.0') 

    testCompile group: 'junit', name: 'junit', version: '4.11' 
    testCompile('org.hamcrest:hamcrest-all:1.3') 
    testCompile('org.mockito:mockito-all:1.9.5') 

} 

war { 
    from 'src/main' // include source files in war 
} 

我运行此命令的gradle:

~/workspaceQa/MobileAutomationWebService/web-services ⮀ 
❯ ./gradlew war 

但在创建战我没有看到图书馆服务类

和我的服务抛出ClassNoFound异常。

这里是我的日志的一部分。我怎样才能解决这个问题?

12:10:28.081 [INFO] [org.gradle.BuildLogger] Tasks to be executed: [task ':library-services:compileJava', task ':library-services:processResources', task ':library-services:verifyDependencies', task ':library-services:classes', task ':library-services:setProjectVersion', task ':library-services:jar', task ':web-services:compileJava', task ':web-services:processResources', task ':web-services:verifyDependencies', task ':web-services:classes', task ':web-services:war'] 
+0

我认为你需要运行时的依赖。它扩展了编译依赖。它应该是:运行时项目(':library-services')。根据:https://docs.gradle.org/current/userguide/war_plugin.html(47.6) – OscarBcn

+0

为什么?它应该依赖于编译时间。没有? –

+0

我认为运行时扩展了编译,看起来你在运行时需要这些类,而不仅仅是编译时。运行时,你的依赖项目应该包含在你的lib文件夹中,这些类将准备好用于你的web服务项目 – OscarBcn

回答

-1

我删除了这条线的问题得到解决后:

gradle.properties文件:

#org.gradle.parallel=true 
+0

我不会推荐这个解决方案,除非没有别的因为它可以显着增加大型项目的编译时间。 –

相关问题