wiki:Devel/GWTwithMaven

wiki:Devel/Index

Developing GWT Applications with Maven

Creating GWT Artifacts (for Maven Repository Administrator)

  • pack gwt-dev-(OS Name).jar with library files, then create gwt-dev-(OS Name)-(version).jar archives
    • *.dll (windows)
    • *.jnilib (mac)
    • *.so (linux)
  • source:trunk/archive/gwt/dev
  • Deploy the archives into the maven repository (It's just a memorandum. Change the file paths according to your machine environment)
    leo@leopardcat:utgb/utgb-core> mvn deploy:deploy-file 
     -Dfile=$(cygpath -w ~/work/utgb/trunk/archive/gwt/dev/gwt-dev-windows-1.4.60.jar ) \
     -DgroupId=com.google.gwt -DartifactId=gwt-dev-windows \
     -Dversion=1.4.60 \
     -Dpackaging=jar 
     -DrepositoryId=utgb -Durl=file://f:/cygwin/home/leo/work/workspace/utgb/maven/artifact 
    

Project Settings

  • pom.xml
    • use the following setting within build/plugins tag
            <!--  GWT compiler -->
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>
                <execution>
                  <phase>compile</phase>
                  <configuration>
                    <tasks>
                      <property name="classpath.compile" refid="maven.compile.classpath" />
                      <property name="gwt.dev" value="${gwt.dev}" />
                      <property name="gwt.jvmargs" value="${gwt.jvmargs}" />
                      <ant antfile="gwt-home/build-gwt.xml">
                        <property name="gwt.module" value="${gwt.module}" />
                        <target name="compile" />
                      </ant>
                    </tasks>
                  </configuration>
                  <goals>
                    <goal>run</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
      

Behind the scenes

  • source:trunk/utgb/utgb-common/pom.xml
  • utgb-common's pom.xml contains the following setting, that retrieves gwt-dev libraries.
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-gwt-dev</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.google.gwt</groupId>
                      <artifactId>${gwt.dev}</artifactId>
                      <version>${gwt.version}</version>
                      <type>jar</type>
                    </artifactItem>
                    <artifactItem>
                      <groupId>org.xerial.maven</groupId>
                      <artifactId>gwt-ant</artifactId>
                      <version>1.0</version>
                      <type>jar</type>
                    </artifactItem>
                  </artifactItems>
                  <excludes>**/*.pom,META-INF</excludes>
                  <outputDirectory>gwt-home</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
    
  • OS-specific settings are also included:
      <!--  OS dependent settings for GWT compiler -->
      <profiles>
        <profile>
          <id>windows</id>
          <activation>
            <os>
              <family>windows</family>
            </os>
          </activation>
          <properties>
            <swt.os-specific-dep>swt-win32</swt.os-specific-dep>
            <gwt.dev>gwt-dev-windows</gwt.dev>
            <gwt.version>1.4.60</gwt.version>
          </properties>
        </profile>
        <profile>
          <id>unix</id>
          <activation>
            <os>
              <family>unix</family>
            </os>
          </activation>
          <properties>
            <swt.os-specific-dep>swt-linux-gtk-x86</swt.os-specific-dep>
            <gwt.dev>gwt-dev-linux</gwt.dev>
            <gwt.version>1.4.60</gwt.version>
          </properties>
        </profile>
        <profile>
          <id>mac</id>
          <activation>
            <os>
              <family>mac</family>
            </os>
          </activation>
          <properties>
            <swt.os-specific-dep>swt-carbon-macosx</swt.os-specific-dep>
            <gwt.dev>gwt-dev-mac</gwt.dev>
            <gwt.version>1.4.60</gwt.version>
            <gwt.jvmargs>-XstartOnFirstThread</gwt.jvmargs>
          </properties>
        </profile>
      </profiles>
    
    
Last modified 17 years ago Last modified on 10/03/07 15:11:04