Tip: Fast Publish to container (Take 2)

Previously I suggested you could use a folder link to get the GWT plugin to deploy your css/html files directly to the deployed app folder.

I’ve since decided that it’s handier to create an ant build task to copy the files instead, and tell eclipse to run that build file when I change my css or images. To set this up, first create a file called build.xml, which you could base on this:

	<project name="Books GWT App">
	<property name="glassfish" location="C:\work\glassfish"/>
	<property name="gwt-deploy" location="${glassfish}/domains/domain1/applications/j2ee-apps/myEAR/myApp_war/gwt"/>
	<property name="gwt-resources" location="src/package/app/public"/>
	<property name="appname" value="package.app.App"/>
	<target name="deployed.check">
	    <condition property="is-deployed">
            <available file="${gwt-deploy}"/>
	    </condition>
	</target>

	<target name="quick-redeploy"
		depends="deployed.check"
		if="is-deployed"
		description="Re-deploy GWT to Already-Deployed App">
		<copy todir="${gwt-deploy}/${appname}"
			  verbose="true">
			<fileset dir="${gwt-resources}"/>
			<fileset dir="bin.gwt/${appname}"/>
		</copy>
	</target>
</project>

Now when I am editing the css or adding/removing images, it immediately copies the files into the deployed folder. This technique will work for any static resources deployed to a web app, and will save a lot of time waiting for publish if you’re just working on the static resources.

Advertisements

2 Responses to Tip: Fast Publish to container (Take 2)

  1. Do you think it would be useful to call the GWT compiler during builds automatically?

  2. dobes says:

    That might be useful, I’ll add an issue to the tracker for it. The GWT builds are still a bit slow, though, so it might get annoying.

%d bloggers like this: