Solution and Request: Local Build to Geronimo/Tomcat

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Solution and Request: Local Build to Geronimo/Tomcat

Postby jamesdcarroll » Sun Dec 28, 2008 8:56 am

I wanted to be able to build my war locally and then post it to Geronimo and Tomcat manually and was having trouble doing so. I was able to do it by altering the default build.xml thusly:

<?xml version="1.0" encoding="utf-8" ?>
<project name="ImageViewer" default="all" basedir="/home/jim/Projects/Eclipse/Hawkeye">
<description>
This is build file for GWT module 'com.hsbc.na.crs.cim.hawkeye.Hawkeye' deployment.
GWT Designer generates it each time when you initiate deployment.

You can use this file later for manual deployment, but keep in mind, that
classpath is hardcoded in it, so after changes in classpath you should
regenerate build file.
</description>

<property name="gwt.home" value="/home/jim/Programs/gwt-linux-1.5.3" />
<property name="gwt.module.id" value="com.hsbc.na.crs.cim.hawkeye.Hawkeye" />
<property name="war.name" value="Hawkeye.war" />

<target name="jars" description="Package up the module project and required projects as jars">
<mkdir dir="@dot/${gwt.module.id}/WEB-INF/lib" />
<!--=== Hawkeye ===-->
<jar destfile="@dot/${gwt.module.id}/WEB-INF/lib/Hawkeye.jar">
<fileset dir="/home/jim/Projects/Eclipse/Hawkeye/src">
<include name="**"/>
</fileset>
<fileset dir="/home/jim/Projects/Eclipse/Hawkeye/bin">
<include name="**/*.class"/>
</fileset>
</jar>
</target>

<target name="gwt-compile" description="Compile to JavaScript">
<delete dir="@dot" />
<java classname="com.google.gwt.dev.GWTCompiler" fork="yes" failonerror="true" maxmemory="64m">
<classpath>
<pathelement location="/home/jim/Projects/Eclipse/Hawkeye/src" />
<pathelement location="/home/jim/Projects/Eclipse/Hawkeye/bin" />
<pathelement location="/home/jim/Programs/gwt-linux-1.5.3/gwt-user.jar" />
<pathelement location="/home/jim/Programs/gwt-linux-1.5.3/gwt-dev-linux.jar" />
</classpath>
<arg value="-style"/>
<arg value="OBFUSCATED"/>
<arg value="-out" />
<arg file="@dot" />
<arg value="${gwt.module.id}" />
</java>
</target>

<target name="web-xml">
<mkdir dir="@dot/${gwt.module.id}/WEB-INF" />
<echo file="@dot/${gwt.module.id}/WEB-INF/web.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns= "http://java.sun.com/xml/ns/javaee">

<servlet>
<servlet-name>com.hsbc.na.crs.cim.hawkeye.server.HawkeyeServiceImpl</servlet-name>
<servlet-class>com.hsbc.na.crs.cim.hawkeye.server.HawkeyeServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>com.hsbc.na.crs.cim.hawkeye.server.HawkeyeServiceImpl</servlet-name>
<url-pattern>/HawkeyeService</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>
Hawkeye.html
</welcome-file>
</welcome-file-list>

</web-app>
]]></echo>
<echo file="@dot/${gwt.module.id}/WEB-INF/geronimo-web.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
<environment>
<moduleId>
<artifactId>Hawkeye</artifactId>
</moduleId>
</environment>
<context-root>/Hawkeye</context-root>
</web-app>
]]></echo>



</target>

<target name="war" depends="gwt-compile, jars, web-xml">
<!-- update compilation results -->
<!--<delete dir="@dot/${gwt.module.id}/.gwt-compiler" />
<move todir="@dot/${gwt.module.id}">
<fileset dir="@dot/${gwt.module.id}/std">
<include name="**"/>
</fileset>
</move>-->
<!-- do create WAR -->
<delete file="${war.name}" />
<copy file="${gwt.home}/gwt-servlet.jar" todir="@dot/${gwt.module.id}/WEB-INF/lib" />
<jar destfile="${war.name}" basedir="@dot/${gwt.module.id}" duplicate="preserve" />
<!-- clean up
<delete dir="@dot" />-->
</target>

<target name="deploy" depends="war">
<move file="${war.name}" todir="/home/jim/Projects/Eclipse/Hawkeye/war" />
</target>

<target name="all" depends="deploy" />

</project>

Would it be possible to add those bits to the default build.xml that you create? I would also ask that the "deploy" target be split so that there is a clean break between posting it into my project folder and posting it to the server. And, while I'm at it, a bit more control over the build artifacts. Perhaps give folks the option to keep the intermediate artifacts around (the web.xml file in particular), to use an existing file in the build, and or add other files to war (like geronimo-web.xml or anything else. I know that in the doc you make mention that if you need to have more control to create/use a Web Project, but then you also make mention that Web Projects and GWT Projects shouldn't be mixed, so that kind of kills that.

Thanks!
jamesdcarroll
 
Posts: 7
Joined: Fri Dec 26, 2008 7:04 pm

Re: Solution and Request: Local Build to Geronimo/Tomcat

Postby Eric Clayberg » Tue Dec 30, 2008 12:47 pm

jamesdcarroll wrote:I know that in the doc you make mention that if you need to have more control to create/use a Web Project, but then you also make mention that Web Projects and GWT Projects shouldn't be mixed

That is only part of what the docs say. The full quote is:
Note that GWT projects and Web projects are distinct entities and should not be mixed. A Web project can reference GWT modules via its Web Project properties. A Web project should not contain any GWT elements directly.

Why is using a web project inappropriate for what you want to do? It can be used to deploy GWT modules from a separate GWT project.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Solution and Request: Local Build to Geronimo/Tomcat

Postby jamesdcarroll » Thu Jan 01, 2009 10:09 am

Mostly it comes from my perspective that a project should map to product in a very 1:1 manner and that dependencies have to be managed carefully, if not harshly. To me, having 2 projects where one's sole purpose in life is to house a file that basically is a config file for another, just bothers me at certain level. Not denying that it may be mostly a personal hangup, but it is what it is.
jamesdcarroll
 
Posts: 7
Joined: Fri Dec 26, 2008 7:04 pm

Re: Solution and Request: Local Build to Geronimo/Tomcat

Postby Eric Clayberg » Sat Jan 03, 2009 9:04 am

In the latest build, we have made it possible to supply your own built template that we will use when generating the build.xml file.

The default build templates are named build-1.5.xml and build-1.4.xml and are located in the com.swtdesigner.gwt.actions.deploy package of the com.swtdesigner.gwt plugin.

The build-1.5.xml template looks like this:

build-1.5.xml
(2.22 KiB) Downloaded 68 times

You can now override/modify that template by placing your own version in your GWT module folder. You can add/move operations and targets as long as the script still references the same template variables.

buildxml.png
buildxml.png (211.21 KiB) Viewed 735 times

It is up to user to get any new templates from GWTD jar, if we change something and the old script becomes invalid.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests