GWT Anwendung in JEE-Projekt integrieren

Sirakov

Mitglied
Ich habe mit GWT ein einfaches Beispiel erstellt (bestehend aus 5 GUI-Elemente). Als GWT-Projekt lässt die Anwendung starten. Jetzt versuche ich diese in ein anderes Projekt zu importieren. Das Problem ist, dass unsere Struktur anders als bei dem GWT-Projekt ist. Kann mir jemand sagen, was und wo geändert werden muss, damit ich über das Kontextmenü -> Debug as -> Google Web Application diese starten kann. Ich bin soweit gekommen, dass dieser Eintrag im Kontextmenü erscheint, allerdings kriege ich folgende Fehlermeldung bei der Ausführung:
Could not find any host pages in projekt

Wenn ich stattdessen kompilieren will, bekome ich eine java.lang.NullPointerException ohne weiterere Informationen.
 
Du musst die mal die .project ansehen

Wesentlich schöner ist es allerdings das compilieren diekt in den build process mit einzubauen:

XML:
	<path id="gwt.compile.class.path">
		<pathelement location="${build.src}" />
		<pathelement path="${build.gwt.src}" />
		<fileset dir="${build.lib.runtime}" id="compile.lib">
			<include name="*.jar" />
		</fileset>
		<fileset dir="${project.lib.compile}" id="runtime.lib">
			<include name="*.jar" />
		</fileset>
		<fileset dir="${project.lib.gwt}" id="gwt.lib">
			<include name="*.jar" />
		</fileset>
	</path>


XML:
	<target name="compileGWT">
		<gwtCompile module="com.my.package.Module" classpathref="gwt.compile.class.path" output="war" />
	</target>

XML:
	<path id="gwt.compile.class.path">
		<pathelement location="${build.src}" />
		<pathelement path="${build.gwt.src}" />
		<fileset dir="${build.lib.runtime}" id="compile.lib">
			<include name="*.jar" />
		</fileset>
		<fileset dir="${project.lib.compile}" id="runtime.lib">
			<include name="*.jar" />
		</fileset>
		<fileset dir="${project.lib.gwt}" id="gwt.lib">
			<include name="*.jar" />
		</fileset>
	</path>

XML:
<macrodef name="gwtCompile">
	<attribute name="module" />
	<attribute name="classpathref" />
	<attribute name="output" />
	<sequential>
		<java classpathref="@{classpathref}" classname="com.google.gwt.dev.Compiler" fork="true">
			<arg value="-war" />
			<arg value="@{output}" />
			<arg value="@{module}" />
			<jvmarg value="-Xmx256M" />
		</java>
	</sequential>
</macrodef>

So kann direkt nach dem Java compile, GWT kompiliert und das WAR gebaut werden.

Viele Grüße
f.
 
Zuletzt bearbeitet von einem Moderator:
ja, da hast du recht, dass im build-Prozess schöner ist...so habe ich es auch gemacht und ich starte die Anwendung im dev mode über maven... ;)
 

Neue Beiträge

Zurück