Google WebToolkit, Maven2

DerGrinsemann

Mitglied
[solved] Google WebToolkit, Maven2

Hallo!

Ich bin knapp am verzweifeln, da ich ziemlich unter Zeitdruck stehe ...

Kennt jemand eine funktionierende Möglichkeit die Version 1.5 RC1 oder Version 1.5.1 (RC2) vom GWT in Maven2 zu integrieren?

Alle bisher von mir gefundenen Maven-Plugins, Tutorials usw. enden entweder bei der Version 1.4.6 bzw. 1.5 M1 oder funktionieren einfach nicht.

Falls jemand von euch eine funktionierende Konfiguration hat - bitte posten!

Marco
 
Zuletzt bearbeitet:
Tja, ich bin von 1.4.6 ausgegangen und mein Kollege hat den kompletten RPC-Layer mit 1.5RC1 geschrieben ... und ich darf das ganze jetzt in Maven zusammenführen :mad:

Ich bin jetzt bei einem Ant-Build gelandet der in Maven2 eingebunden wird.

Code:
	    <plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-antrun-plugin</artifactId>
		<executions> 
		    <execution> 
			<phase>generate-sources</phase> 
			<configuration> 
			    <tasks> 
				<ant antfile="${basedir}/build.xml"> 
				    <property name="settings.localRepository" value="${settings.localRepository}" /> 
				    <target name="CompileGWTSources" />
				</ant> 
			    </tasks> 
			</configuration> 
			<goals> 
			    <goal>run</goal> 
			</goals> 
		    </execution> 
		</executions> 
	    </plugin>

Code:
<?xml version="1.0" encoding="utf-8" ?>
<project name="VetMed" default="compile" basedir=".">
    <target name="CompileGWTSources">
    <java fork="true" classname="com.google.gwt.dev.GWTCompiler">
	<jvmarg value="-XstartOnFirstThread"/>
	<arg value="-logLevel" /> 
	<arg value="DEBUG" /> 
	<arg value="-out" /> 
	<arg value="${basedir}/target" />
	<arg value="at.brisk.vetmed.gui.VetMed" /> 
	<classpath> 
	    <pathelement location="${basedir}/src/main/java/" /> 
	    <pathelement location="/Users/marcomarkl/Workspace/Java_Libs/GoogleWebToolkit/gwt-mac-1.5.1/gwt-dev-mac.jar" /> 
            <pathelement location="/Users/marcomarkl/Workspace/Java_Libs/GoogleWebToolkit/gwt-mac-1.5.1/gwt-user.jar" /> 
	    <pathelement location="/Users/marcomarkl/Workspace/Java_Libs/GoogleWebToolkit/gwtext-2.0.4/gwtext.jar" />
	</classpath>
    </java>
    </target>
</project>

Wobei ich im Ant-File derzeit ziemlich rumbastle - also fixe Pfadangaben usw. - um einfach mal einen funktionierenden Build zu bekommen.

Andere Ideen, Vorschläge, .... Lösungen? :)
 
Zuletzt bearbeitet:
Nachdem mir dieses Forum und dessen Mitglieder schon sehr oft geholfen haben, möchte ich jetzt was zurückgeben. Anbei "meine" Lösung um das Google Web Toolkit Version 1.5.1 in einen Maven2-Build einzubinden.

Für Anregungen, Ideen, Vorschläge bin ich immer zu haben! :)

pom.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

[...]

	<!-- Google Web Toolkit and Extensions -->
	<dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>1.5.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>1.5.1</version>
        </dependency>

[...]

    <build>
	<plugins>
	    <plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-antrun-plugin</artifactId>
		<executions> 
		    <execution> 
			<phase>process-classes</phase> 
			<configuration> 
			    <tasks>
				<property name="plugin_classpath" refid="maven.plugin.classpath"/>
				<ant antfile="${basedir}/buildCompileGWTSources.xml">
				    <!-- Specifies the name of the module to compile -->
				    <property name="gwtModule" value="at.brisk.vetmed.gui.VetMed"/>
				    <!-- Script output style: OBF[USCATED], PRETTY, or DETAILED (defaults to OBF) -->
				    <property name="gwtStyle" value="OBF"/>
				    <!-- The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL -->
				    <property name="gwtLogLevel" value="ERROR"/>
				    <!-- Deploy Directory -->
				    <property name="gwtDeployTarget" value="${basedir}/target/VetMed/"/>
				    <target name="CompileGWTSources" />
				</ant> 
			    </tasks> 
			</configuration> 
			<goals> 
			    <goal>run</goal> 
			</goals> 
		    </execution> 
		</executions>
		<dependencies>
		    <dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>1.5.1</version>
		    </dependency>
		    <dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-dev</artifactId>
			<version>1.5.1</version>
		    </dependency>
		</dependencies>
	    </plugin>
	</plugins>
    </build>

[...]

</project>

buildCompileGWTSources.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<project name="CompileGWTSources" default="compile" basedir=".">
    <target name="CompileGWTSources">
    <java fork="true" classname="com.google.gwt.dev.GWTCompiler">
	<jvmarg value="-XstartOnFirstThread"/>
	<jvmarg value="-Xmx256M" />
	<arg value="-logLevel" /> 
	<arg value="${gwtLogLevel}" /> 
	<arg value="-out" />
	<arg value="${basedir}/target/gwt" />
	<arg value="-style" />
	<arg value="${gwtStyle}" />
	<arg value="${gwtModule}" /> 
	<classpath>
	    <pathelement location="${basedir}/src/main/java/" />
	    <pathelement path="${plugin_classpath}" />
	</classpath>
    </java>
    <copy todir="${gwtDeployTarget}">
	<fileset dir="${basedir}/target/gwt/${gwtModule}/" />
    </copy>
    </target>
</project>

Marco
 
Hallo!

Anbei eine überarbeitete Lösung um Google Webtoolkit und gwt-ext in einen Maven2-Build zu integrieren:

pom.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    
    <!-- Repositories -->
    <repositories>

       <!-- GWT Ext-->
	<repository>
	    <id>gwtext</id>
	    <url>http://www.gwt-ext.com/maven2/</url>
	</repository>

    </repositories>
  
  <!-- Dependencies -->
    <dependencies>
	
	<!--  GWT deps (from central repo) -->
	<dependency>
	    <groupId>com.google.gwt</groupId>
	    <artifactId>gwt-servlet</artifactId>
	    <version>${gwtVersion}</version>
	    <scope>runtime</scope>
	</dependency>
	<dependency>
	    <groupId>com.google.gwt</groupId>
	    <artifactId>gwt-user</artifactId>
	    <version>${gwtVersion}</version>
	    <scope>provided</scope>
	</dependency>
	<dependency>
	    <groupId>com.google.gwt</groupId>
	    <artifactId>gwt-dev</artifactId>
	    <version>${gwtVersion}</version>
	    <classifier>${platform}-libs</classifier>
	    <type>zip</type>
	    <scope>provided</scope>
	</dependency>
	<dependency>
	    <groupId>com.google.gwt</groupId>
	    <artifactId>gwt-dev</artifactId>
	    <version>${gwtVersion}</version>
	    <classifier>${platform}</classifier>
	    <scope>provided</scope>
	</dependency>
	
	<!-- GWT Ext -->
	<dependency>
	    <groupId>com.gwtext</groupId>
	    <artifactId>gwtext</artifactId>
	    <version>${gwtExtVersion}</version>
	    <scope>provided</scope>
	</dependency>

    </dependencies>
  
  <!-- Build -->
    <build>

	<plugins>
	    
	    <!-- GWT Build -->
	    <plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-antrun-plugin</artifactId>
		<executions>
		    <execution>
			<phase>process-classes</phase>
			<configuration>
			    <tasks>
				<property name="plugin_classpath" refid="maven.plugin.classpath" />
				<property name="targetPath" value="${project.build.directory}/${project.build.finalName}/" />
				<ant antfile="${basedir}/buildGWTSources.xml">
				    <target name="compile" />
				    <!-- Specifies the name of the module to compile -->
				    <property name="gwtModule" value="at.brisk.worklite.gui.WorkLite" />
				    <!-- Script output style: OBF[USCATED], PRETTY, or DETAILED (defaults to OBF) -->
				    <property name="gwtStyle" value="OBF" />
				    <!-- The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL -->
				    <property name="gwtLogLevel" value="ERROR" />
				</ant>
			    </tasks>
			</configuration>
			<goals>
			    <goal>run</goal>
			</goals>
		    </execution>
		</executions>
		<dependencies>
		    <dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>${gwtVersion}</version>
		    </dependency>
		    <dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-dev</artifactId>
			<version>${gwtVersion}</version>
			<classifier>${platform}</classifier>
		    </dependency>
		    <dependency>
			<groupId>com.gwtext</groupId>
			<artifactId>gwtext</artifactId>
			<version>${gwtExtVersion}</version>
		    </dependency>
		</dependencies>
	    </plugin>
	    
	</plugins>
    </build>
  
    <!--  GWT profiles (with activation per platform) -->
    <profiles>
	<profile>
	    <id>gwt-dev-windows</id>
	    <properties>
		<platform>windows</platform>
	    </properties>
	    <activation>
		<activeByDefault>true</activeByDefault>
		<os>
		    <family>windows</family>
		</os>
	    </activation>
	</profile>
	<profile>
	    <id>gwt-dev-mac</id>
	    <properties>
		<platform>mac</platform>
	    </properties>
	    <activation>
		<activeByDefault>false</activeByDefault>
		<os>
		    <family>mac</family>
		</os>
	    </activation>
	</profile>
	<profile>
	    <id>gwt-dev-linux</id>
	    <properties>
		<platform>linux</platform>
	    </properties>
	    <activation>
		<activeByDefault>false</activeByDefault>
		<os>
		    <name>linux</name>
		</os>
	    </activation>
	</profile>
    </profiles>
  
    <!-- Properties -->
    <properties>
	
<!--  convenience to define GWT version in one place -->
	<gwtVersion>1.5.3</gwtVersion>
	<!--  convenience to define GWT Ext version in one place -->
	<gwtExtVersion>2.0.5</gwtExtVersion>

    </properties>

</project>

buildGWTSources.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<project name="CompileGWTSources" default="compile" basedir=".">
	<target name="compile">
		<java fork="true" classname="com.google.gwt.dev.GWTCompiler">
			<jvmarg value="-XstartOnFirstThread"/>
			<jvmarg value="-Xms256M" />
			<jvmarg value="-Xmx512M" />
			<arg value="-logLevel" /> 
			<arg value="${gwtLogLevel}" /> 
			<arg value="-out" />
			<arg value="${basedir}/target/gwt" />
			<arg value="-style" />
			<arg value="${gwtStyle}" />
			<arg value="${gwtModule}" /> 
			<classpath>
				<pathelement location="${basedir}/src/main/java/" />
				<pathelement path="${plugin_classpath}" />
			</classpath>
		</java>
		<copy todir="${targetPath}">
			<fileset dir="${basedir}/target/gwt/${gwtModule}/" />
		</copy>
	</target>
</project>

Marco
 

Neue Beiträge

Zurück