1. 程式人生 > >使用maven來建立和管理你的gwt1.6專案

使用maven來建立和管理你的gwt1.6專案

下面這段程式碼就是建立gwt1.6專案的maven命令。

[quote]mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=1.1 -DarchetypeRepository=http://repository.codehaus.org/ -DgroupId=com.example -DartifactId=maven-example[/quote]


如果發現有下面的問題的話, 你需要在maven repositroy中刪除對應的plugin。這樣maven會download最新的版本。

[quote][ERROR] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Required goal not found: archetype:generate in org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7
[INFO] ————————————————————————
[INFO] For more information, run Maven with the -e switch[/quote]


建立完專案後,進入maven-example中, 執行maven clean install, 會download一些依賴包,好像我這裡關於一些gwt的jar需要手動install到maven repository裡面。 反正執行失敗後它會給出install的maven命令。 你只需要下載相應的jar或者zip包然後執行maven install命令就行了。

大功告成, 你可以執行mvn gwt:run來啟動你的gwt應用了。

這裡是使用[url=http://mojo.codehaus.org/gwt-maven-plugin/plugin-info.html]gwt-maven-plugin[/url]來建立gwt專案。具體的maven goals可以看這裡http://mojo.codehaus.org/gwt-maven-plugin/plugin-info.html