-
Notifications
You must be signed in to change notification settings - Fork 45
Selective compilation #33
Comments
Stefen, This seems possible, can you please post an example (or update the docs)? |
Ideally you would refactor your project into a multi module project so that you actually have a client, shared and server project each with its own build file. This would also separate the classpath so your GWT libraries do not interference with server libraries anymore. I guess that would be a good additional example. |
Yeah .. I figured that too, but I do not want the plug-in to force me to do On Wed, May 14, 2014 at 8:51 AM, Jens Nehlmeier notifications@github.comwrote:
/ Hristo Stoyanov |
About the first part (excluding server from GWT compilation): This isn't possible as the GWT compiler only gets the sources as part of the classpath. The classpath can only contain folders or jar files. The folders must contain valid java packages, so you can't simply reference a subpackage only. About the second part (excluding client stuff from Java compilation): Here you go: From my personal view, I would never want the client code to be excluded from Java compilation for the following reasons:
So let's come to alternative solutions ... You either have to introduce separate projects (You already said you don't want to do this) for each of the parts or put them in separate sourceSets: There are several facets of solving this. To make it as simple as possible, let's think about one thing: The only part that should be handled by both (GWT compiler and should be included in the war file) is the shared stuff. so let's put this into src/main/java. For the other two we need additional sourceSets:
Both sourceSets depend on the main sourceSet as both only compile with the shared stuff being available. To add the server classes to the war, you need:
For GWT you need to add the client sources:
To make all GWT tasks to work as expected you should also need something like this:
I can't test this by now so this is all untested code. But I think it should lead to a working solution with proper separation and up to date checks but without separate projects. I hope this helps. |
Thanks a lot, Steffen! I will give it a try ...but you see my pain: if i /Hristo Stoyanov About the first part (excluding server from GWT compilation): This isn't About the second part (excluding client stuff from Java compilation): Here From my personal view, I would never want the client code to be excluded
So let's come to alternative solutions ... You either have to introduce There are several facets of solving this. To make it as simple as possible, For the other two we need additional sourceSets: sourceSets { Both sourceSets depend on the main sourceSet as both only compile with the To add the server classes to the war, you need: war { For GWT you need to add the client sources: gwt { To make all GWT tasks to work as expected you should also need something tasks.withType(de.richsource.gradle.plugins.gwt.AbstractGwtActionTask) { I can't test this by now so this is all untested code. But I think it I hope this helps. — |
I have a project in which I tried to write such a "3-in-1" build file. I have defined the source sets a bit different, so maybe thats useful for you too:
Later on you can merge client + shared (gwt compilation) and shared + server source sets (build server war) depending on the task. You also have separate dependencies which allows to configure a task with just the classpath it needs, e.g. gwt compilation does not need server dependencies. I haven't finished the build file because I switched to a multi module project but I think you get the idea. It is pretty similar to Steffen's approach. |
Hi,
I have a single project (Gradle war) with the following Java sources:
src/main/java/com/project/client
src/main/java/com/project/shared
src/main/java/com/project/server
where I want to launch Gwt compilation in the client and share packages ONLY and javac compile for the server package. How do I tell this plugin to ignore changes in the server package (or at least do only javac compilation there)?
The text was updated successfully, but these errors were encountered: