Reputation: 155
We are using GWT Version 2.4 in our current project. On server side, we are using Spring & Custom JDBC framework.
We are using Maven as our Build Tool. The application is getting deployed on JBOSS 7 Server.
Currently we have everything in one single Eclipse Project. Means one Application.gwt.xml file and one ApplicationContext.xml for spring. We have around 2000 Java files out of which around 1500 are for GWT related source files.
The project is still growing with more source files.
We are fine with timings of Java to Javac [class file] Compilation time. But when It comes to Java to JavaScript , It is a issue.
We have used all hacks mentioned in the GWT Forum.
Like.
But still the compilation is taking 4-6 minutes.. OR even 7 minutes some times.
With this question, I would like to know the options available to improve the same.
We are thinking to Split the Project like this WAY:
Now Question comes:
1) Will this help us in Improving the compilation time?
2) IF we change only Module 2 and then compile Module Main, will GWT still compile Module 1 as it is inherited by Module Main?
Please share your views on above scenario. We have even tried out GWT 2.5 option but no help in performance improvements.
Thanks, Niraj Salot.
Upvotes: 0
Views: 1042
Reputation: 3934
I 'll reply to your second question first, as it is not GWT specific. Considering your project is structured this way :
project-root
|- module1 (jar)
|- module2 (jar)
L moduleMain (gwt + war)
If you make some changes in module2
, and do not want to recompile module1
, you can use the option -pl
to skip it from the build process (command to launch from the project-root
folder):
mvn clean install -pl module2,moduleMain
This will recompile module2
, and then moduleMain
, without recompiling module1
.
Will this help us in Improving the compilation time ?
It depends how big are module1
and module2
compared to moduleMain
... But my experience with GWT is that a lot of time is generally spent to compile the java client code into javascript. This operation still occurs in your moduleMain
, so I would say that splitting your project into several modules won't be enough to improve the compilation time significantly.
In addition, I advise you to use a profile that will control the activation/deactivation of the gwt-maven-plugin
within moduleMain
.
In the moduleMain
's pom.xml, move the GWT plugin into a profile, this way :
<profiles>
<profile>
<id>GWTBuild</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>com.yoururlroot/index.html</runTarget>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Then, if you just want to rebuild your war because module2
has changed BUT whithout rebuilding module1
AND whithout recompiling all the GWT stuff, simply launch :
mvn clean install -pl module2,moduleMain -P!GWTBuild
In this command, the GWT plugin is deactivated, so maven will only rebuild the war.
Tell me if this is working for you.
Upvotes: 1