Just wanted to finish my previous post on the Maven2 setup with GWT. Since Google/GWT doesn’t provide any maven central repositories you’d have to install them yourself into either your development maven repo or into your local maven repo. Below are the commands to do it (assuming Windows dev env and some path).
There is however one major problem with using GWT hosted mode under maven – it’s the native hosted mode libraries (dlls) and the way Google chose to implement them – a couple of GWT hosted mode dlls need to be located _in the same_ folder where the gwt-dev-windows.jar is present. And thus the hack below to copy the dlls into such location. And no, -Djava.library.path won’t work!!! Unfortunately, this setup will only work with the local maven repositories and will completely fail if you try this trick with the remote maven repos (unless I’m unaware of some other hack).
cmd /c mvn install:install-file -DgroupId=com.google -DartifactId=gwt-dev-windows -Dversion=1.5 -Dpackaging=jar -Dfile=C:/java/gwt/gwt-windows-0.0.0/gwt-dev-windows.jar -DgeneratePom=true -DcreateChecksum=true
cmd /c mvn install:install-file -DgroupId=com.google -DartifactId=gwt-dev-windows -Dversion=1.5 -Dclassifier=sources -Dpackaging=jar -Dfile=C:/java/gwt/gwt-windows-0.0.0/gwt-dev-windows.jar -DgeneratePom=true -DcreateChecksum=true
cmd /c copy C:\java\gwt\gwt-windows-0.0.0\swt-win32-3235.dll C:\java\apache-maven-2.0.8\conf\repository\com\google\gwt-dev-windows\1.5
cmd /c copy C:\java\gwt\gwt-windows-0.0.0\gwt-ll.dll C:\java\apache-maven-2.0.8\conf\repository\com\google\gwt-dev-windows\1.5
cmd /c mvn install:install-file -DgroupId=com.google -DartifactId=gwt-user -Dversion=1.5 -Dpackaging=jar -Dfile=C:/java/gwt/gwt-windows-0.0.0/gwt-user.jar -DgeneratePom=true -DcreateChecksum=true
cmd /c mvn install:install-file -DgroupId=com.google -DartifactId=gwt-user -Dversion=1.5 -Dclassifier=sources -Dpackaging=jar -Dfile=C:/java/gwt/gwt-windows-0.0.0/gwt-user.jar -DgeneratePom=true -DcreateChecksum=true
cmd /c mvn install:install-file -DgroupId=com.google -DartifactId=gwt-servlet -Dversion=1.5 -Dpackaging=jar -Dfile=C:/java/gwt/gwt-windows-0.0.0/gwt-servlet.jar -DgeneratePom=true -DcreateChecksum=true
cmd /c mvn install:install-file -DgroupId=com.google -DartifactId=gwt-servlet -Dversion=1.5 -Dclassifier=sources -Dpackaging=jar -Dfile=C:/java/gwt/gwt-windows-0.0.0/gwt-servlet.jar -DgeneratePom=true -DcreateChecksum=true
One more thing, I find that Jetty’s manual refresh mode available in maven-jetty-plugin version 6.1.12.rc2+ be very handy when developing stuff with GWT and java/jetty/spring. I can edit my GWT files all I want and only reload server stuff when I indeed changed something in the server side java code (rather than the Java code that gets compiled into javascript by GWT but leaves in the same maven project). Here is my jetty maven plugin configuration that I use for the -noserver development, in case you are interested
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.12.rc2</version>
<configuration>
<reload>manual</reload>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9997</stopPort>
<webAppConfig>
<contextPath>/</contextPath>
<defaultsDescriptor>src/main/servers/jetty/dev/webdefault.xml</defaultsDescriptor>
</webAppConfig>
<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*</include>
</includes>
</scanTargetPattern>
</scanTargetPatterns>
</configuration>
</plugin>
Anyway, hopefully this was useful for some of you and look forward to any comments.
Filed under: compiler |
Hi,
Now GWT libs are in the repository 🙂
com.google.gwt
gwt-user
1.5.2
provided
Thank you VERY VERY much! Finally I have GWT + Eclipse + Maven running together.
the only thing that I am doing different is that I am using cypal plugin in order to execute the application. I could not do it using your way.
Now I will analyze if I will stop using echo2 or not. Personally I don´t like the idea of writing html and/or CSS…
Regards
Samuel