歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu: 從 Maven構建GWT-Ext應用

Ubuntu: 從 Maven構建GWT-Ext應用

日期:2017/2/28 16:26:48   编辑:Linux教程

Ubuntu下成功從maven構建gwtext應用,還是很簡單的。先用maven構建gwt框架,為eclipse產生project文件方便導入,然後可以用eclipse進行編輯。下載extjs2.0.2並將主要文件拷入public/js/ext目錄下。往pom.xml中添加gwtext的repository, dependency,往gwt.xml中添加inherits, stylesheet和scripts.搞定!

運行:運行pom.xml將在target下得到webcontent,把它加入eclipse裡的tomcat7, 運行服務器,就可以打開index.html得到結果。 【6688電子商務網站 www.6688.cc 】

前提環境:eclipse helios, tomcat7, maven3.0, 其中看到gwt用的是1.5.3,extjs要用2.0.2。

1,mvn archetype:generate, choose maven gwt archetype.
2, cd {$artifactId}, mvn eclipse:eclipse
3, import project in eclipse.
3.1, download extjs2.0.2, copy adapter, resources and ext-all.js to public/js/ext folder.
3.2, add following items in pom.xml:
<repositories>
<repository>
<id>gwtext</id>
<url>
http://www.gwt-ext.com/maven2/
</url>
</repository>
</repositories>
<dependency>
<groupId>com.gwtext</groupId>
<artifactId>gwtext</artifactId>
<version>2.0.5</version>
</dependency>
3.3, add following items in gwt.xml:
<inherits name='com.gwtext.GwtExt'/>
<stylesheet src="js/ext/resources/css/ext-all.css" />
<script src="js/ext/adapter/ext/ext-base.js" />
<script src="js/ext/ext-all.js" />
3.4, then you can modify your ${entryPoint}.java for testing:
Panel p=new Panel();
p.setTitle("main");
RootPanel.get().add(p);
run pom.xml as maven package, war folder get generated in target, add it to your tomcat7 in eclipse, start tomcat7, run index.html on server, done!

references:
http://gwt-ext.com/wiki/index.php?title=Tutorial:Introduction_to_GWT-Ext_2.0#Configuring_Your_Application
往gwt中添加gwtext.
http://code.google.com/p/gwt-ext/issues/detail?id=180
往maven中添加gwt.
注意過程中要為project添加dynamic web module否則不能添加到tomcat中。

Copyright © Linux教程網 All Rights Reserved