Gavin.Chen 发表于 2013-1-28 13:04:35

gwt-maven-archetype source code

使用方法
 
1. 首先你得能运行maven,至于maven是什么,怎么用,自己先去其它地方学会先吧,然后还要下载gwt-windows-1.5.3
 
2. 解压源代码,在命令行中进行该目录,运行mvn install进行archetype安装
 
3. 使用此archetype
    在任一位置建一文件夹,在命令行中运行以下命令
C:\test\test-maven-gwt-archetype>mvn archetype:create -DarchetypeGroupId=com.mycompany -DarchetypeArtifactId=gwt-maven-archetype -DarchetypeVersion=1.0-SNAPSHOT -DgroupId={你的groupId} -DartifactId={你的artifactId}
 

 
C:\test\test-maven-gwt-archetype>mvn archetype:create -DarchetypeGroupId=com.myc
ompany -DarchetypeArtifactId=gwt-maven-archetype -DarchetypeVersion=1.0-SNAPSHOT
 -DgroupId=com.mycompany -DartifactId=test-maven-gwt-archetype
 
4. 成功运行以上命令后,你还需要改一点东西(如果你的groupId用了com.mycompany,则不需改任何东西)
   1) 在src\main\resources下,建立与你的groupId一至的目录,然后在src\main\resources\com\company下的public文件夹与Main.gwt.xml剪切至你刚才新建的目录中
 
   2) 打开你刚才拷贝的Main.gwt.xml文件,找到下面这句,将com.mycompany改成你的groupId
<entry-point class='com.mycompany.client.Main'/> 
   3) 打开你刚才拷贝的public文件夹下的Main.html文件,找到下面这句,将com.mycompany改成你的groupId
<script type="text/javascript" language="javascript" src="com.mycompany.Main.nocache.js"></script> 
   4) 打开根目录的pom文件,在最下面找到下面这段XML,并将google.webtoolkit.home里面的值改成你的GWT安装目录
<profile>            <activation>                <activeByDefault>true</activeByDefault>            </activation>            <id>gwt-home</id>            <properties>                <google.webtoolkit.home>D:/project/project tools/gwt-windows-1.5.3</google.webtoolkit.home>            </properties>      </profile> 
然后在根目录运行mvn gwt:gwt,你应该可以成功看到GWT 红色的Host Mode出现了
 
 
GWT Host Mode是日常测试所用,在要打包项目时,需将Profile "dev-build"激活, 如下命令
 
mvn -Pdev-build install
 
运行这条命令,GWT才会被真正编译成javascript文件,并能部署到容器里面
页: [1]
查看完整版本: gwt-maven-archetype source code