eclipse - Gradle GWT多项目,compileGwt未找到子项目类路径

标签 eclipse gwt gradle

我有一个多项目GWt Gradle,其中gradle的compileGwt找不到子项目,但是如果我使用标准的Eclipse GWT插件,则可以很好地编译

通过gradle构建时,出现以下错误

:main:compileGwt
Loading inherited module 'com.stratebo.gwt.client.main.MainPage'
Loading inherited module 'com.stratebo.gwt.common'
  [ERROR] Unable to find 'com/stratebo/gwt/common.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

项目结构如下:
TMSRoot
|--settings.gradle
|--build.gradle
|--CommonGwt
|----build.gradle
|--main
|----build.gradle

Tms根settings.gradle
include "CommonGWT", "main"

TmsRoot build.gradle
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'

repositories {
   mavenCentral()
}

dependencies {
    testCompile 'junit:junit:4.8.2'

}

version = '1.0'

jar {
    manifest.attributes provider: 'Stratebo Technologies'
}
}
project('main'){
dependencies {
compile project(":CommonGWT")
}
}

CommonGWT build.gradle
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'gwt'
apply plugin: 'eclipse'
apply plugin: 'jetty'


dependencies {
compile 'org.slf4j:slf4j-api:1.7.12'
testCompile 'junit:junit:4.12'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0'
buildscript {
    repositories {
        jcenter() //repository where to fetch gwt gradle plugin
}
dependencies {
    classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
    classpath  files(project(":CommonGWT").sourceSets.main.java.srcDirs)
}
}

repositories {
   mavenCentral()
}

compileJava{
    options.incremental = true
}

gwt {
   gwtVersion='2.7.0'
   modules 'com.stratebo.gwt.common'

  sourceSets {
    main {
        java {
            srcDir 'src'
        }
    }
}
logLevel = 'ERROR'
minHeapSize = "512M";
maxHeapSize = "1024M";
superDev {
    noPrecompile=true
}

Eclipse.
eclipse{
    addGwtContainer=false // Default set to true
}

jettyRunWar.httpPort = 8089
}
task wrapper(type: Wrapper) {
    gradleVersion = '2.8'
}

主要的build.gradle
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'gwt'
apply plugin: 'eclipse'
apply plugin: 'jetty'


dependencies {
compile 'org.slf4j:slf4j-api:1.7.12'
testCompile 'junit:junit:4.12'
}

sourceCompatibility = 1.7
targetCompatibility = 1.7

version = '1.0'

dependencies{
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
compile group: 'org.gwtbootstrap3', name: 'gwtbootstrap3', version: '0.9.1'
compile group: 'junit', name: 'junit', version: '4.11'
compile project(':CommonGWT')

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

 def platformSources() {

return files('../CommonGWT/src/main/java', '../CommonGWT/src/main/resources')

}
buildscript {
repositories {
    jcenter() //repository where to fetch gwt gradle plugin
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
}
}

repositories {
mavenCentral()
}

compileJava{
options.incremental = true
}
gwt {
gwtVersion='2.7.0'
modules 'com.stratebo.gwt.client.main.MainPage'
sourceSets {
    main {
        java {
            srcDir 'src'

        }
    }
}
logLevel = 'ERROR'
minHeapSize = "512M";
maxHeapSize = "1024M";
superDev {
    noPrecompile=true
}
eclipse{
    addGwtContainer=false // Default set to true
}
//Specify the deployment Port
jettyRunWar.httpPort = 8089
}
task wrapper(type: Wrapper) {
gradleVersion = '2.8'
}

CommonGWt common.gwt.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.6.1/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.google.gwt.user.User" />
<inherits name="com.stratebo.gwt.common" />
<source path="client" />
<source path="common" />
</module>

最后是Main MainPage.gwt.xml


<module>
    <inherits name="org.gwtbootstrap3.GwtBootstrap3NoTheme" />
    <inherits name="com.google.gwt.user.User" />
    <stylesheet src="/mytheme.cache.css" />
    <entry-point class="com.stratebo.gwt.client.main.MainPage">
</entry-point>
<inherits name="com.stratebo.gwt.common" />
<source path="client" />
<source path="common" />
</module>

任何帮助表示赞赏

最佳答案

我认为您缺少来自commonGWT项目的源,可以将其添加到jar commonGWT build.gradle中:

    jar {
        from sourceSets.main.allSource
    }

commonGWT jar将包含允许编译依赖项目的源。

关于eclipse - Gradle GWT多项目,compileGwt未找到子项目类路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33661435/

相关文章:

eclipse - 在 Eclipse 中,如何选择垂直连续的文本框,就像在 Notepad++ 中使用 alt+drag 一样?

eclipse - Eclipse:如何使目录树显示为包

GWT Widget.addHandler

java - 在 smartgwt 的 htmlflow 中获取文本框的值

java - 如何在eclipse中禁用ant

java - Eclipse 中 Thread.run() 的调用层次结构

css - 无法在 GWT 的全屏 ScrollView 内的面板中获取正确的背景图像

java - 在 MacOSx 上使用 Gradle 编译一个简单的 Junit 测试

android - 错误版本发布APK

groovy - 从: to: in Gradle script申请施工