Hello, I have a problem with GWT compiling, here is my situation: First I have defined the sourceSets and the dependencies in another file dependencies.gradle
apply from: 'gradle/dependencies.gradle'
apply from:'java'
sourceSets{
myproject{
java.srcDirs=[
'backend',
'shared',
'dashboard_web',
'gwt_common',
'surveys-backend',
'widgety',
"$buildDir/home/publication-log/instances/$customer/configuration",
]
output.classesDir=file("$buildDir/bin")
compileClasspath= sourceSets.main.output+ configurations.myproject
runtimeClasspath= output+compileClasspath
}
Then I have created the the gwt compiling tasks:
task gwtcompile(type:JavaExec)<<{
main="com.google.gwt.dev.Compiler"
classpath=sourceSets.myproject.runtimeClasspath
args "-style"
args "PRETTY"
args "-localWorkers"
args "5"
args "-war"
args "$buildDir/war"
args "com.myproject.FrontEnd"
jvmArgs "-Xmx1024M"
jvmArgs "-Xss1024k"
jvmArgs "-Djava.awt.headless=true"
}
task classeswar<<{
JavaCompile{
source = sourceSets.myproject.output.classesDir
classpath = sourceSets.myproject.runtimeClasspath
destinationDir="$buildDir/war/WEB-INF/classes"
}
}
Finally when I run the gwtcompile task I get this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gwtcompile'.
> No main class specified
...
Thank you
Tasks cannot be configured with << (remove the <<). Also, ‘JavaCompile { … }’ is not a valid declaration. Perhaps what you meant is ‘task classesWar(type: JavaCompile) { … }’.
Thank you Peter, I have updated my code:
...
task gwtcompile(type:JavaExec){
main="com.google.gwt.dev.Compiler"
classpath=sourceSets.myproject.runtimeClasspath
args "-style"
args "PRETTY"
args "-localWorkers"
args "5"
args "-war"
args "$buildDir/war"
args "com.myproject.FrontEnd"
jvmArgs "-Xmx1024M"
jvmArgs "-Xss1024k"
jvmArgs "-Djava.awt.headless=true"
}
Then I have this error below, I’am not sure but I think I haven’t include the srcDirs how can I do that?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gwtcompile'.
> A problem occurred starting process 'command 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe''
Finally for classeswar task you was right I don’t have to use"<<"
I’am not sure but I think I haven’t include the srcDirs how can I do that?
You’ll need to look this up in the gwt docs.
ok, thank you again Peter
I have fixed the issue of running the gwt compiler:
task gwtcompile(type:JavaExec){
main="com.google.gwt.dev.Compiler"
classpath=configurations.gwt
args "-style"
args "PRETTY"
args "-localWorkers"
args "5"
args "-war"
args "$buildDir/war"
args "com.myproject.FrontEnd"
jvmArgs "-Xmx1024M"
jvmArgs "-Xss1024k"
jvmArgs "-Djava.awt.headless=true"
}
now my problem is with resources:
[ERROR] Unable to find 'com/myproject/FrontEnd.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Well this file exist in “$projectDir/dashboard_web” directory My question how to include this file in the classpath also if it is possible to use previous definition of sourceSets. Thank you