gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 04:02:52 25 4
gpt4 key购买 nike

我有一个多项目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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com