steffenschaefer / gwt-gradle-plugin

Gradle plugin to support GWT (http://www.gwtproject.org/) related tasks.
Other
117 stars 45 forks source link

[GWT 2.8/Pluging 0.6] Issue with gwt sub-projects #101

Open hrstoyanov opened 8 years ago

hrstoyanov commented 8 years ago

Hello, If my understanding from the war-using-library example is correct, if one has two projects like:

Then in the war project gradle file (web-app/build.gradle), the shared library can be incorporated like this:

gwt { 
    modules     "${gwt_app_modules}"
    devModules  "${gwt_app_modules}"
    gwtVersion  "${gwt_version}"
    src       += files(project(':web-shared').sourceSets.main.allJava.srcDirs) + files(project(':web-shared').sourceSets.main.output.resourcesDir)
...
}

The problem I see is that the compiled classes from the library project do not go into web-app/build/classes, but are generated directly in the source tree of the war project: web-app/src/main/WEB-INF/classes, which is really bad!

It seems that I need to set some property in my web-app/build.gradle to tell it where to place the compile results from the imported library... Something like this (which does not work!):

gwt {

    modules     "${gwt_app_modules}"
    devModules  "${gwt_app_modules}"
    gwtVersion  "${gwt_version}"
    src       +=  <same as above>
    output = $projectDit/build
...
}

Any idea what is going on and how to fix it? Could this be GWT 2.8 issue?Thanks!

hrstoyanov commented 8 years ago

My temp solution is this:

task cleanUpAfterCompileGwt << {
    delete  "${projectDir}/src/main/webapp/WEB-INF/classes/com", "${projectDir}/src/main/webapp/WEB-INF/classes/org"
}
compileGwt.finalizedBy(cleanUpAfterCompileGwt)

At this point though, I am not sure if this is plug-in's fault. There are some linkers/codegenerators at play in my case that I suspect too.

Also note, that the web-shared project does not need to anything but an ordinary java project with GWT structure ( e.g you can skip the gwt plugin stuff), something not very obvious from the example...