您的位置:首页 > 其它

GWT开发 - 创建GWT Maven Project

2012-12-03 00:45 309 查看
使用工具创建GWT Maven Project有两种方式,使用GWT Command-line ToolsMaven GWT Plugin

1. 使用GWT Command-line Tools创建maven project

要使用webAppCreator命令,

运行

webAppCreator -help

WebAppCreator [-overwrite] [-ignore] [-templates template1,template2,...] [-out dir] [-junit pathToJUnitJar] [-maven] [-noant] moduleName

where
-overwrite    Overwrite any existing files
-ignore       Ignore any existing files; do not overwrite
-templates    Specifies the template(s) to use (comma separeted). Defaults to 'sample,ant,eclipse,readme'
-out          The directory to write output files into (defaults to current)
-junit        Specifies the path to your junit.jar (optional)
-maven        Deprecated. Create a maven2 project structure and pom file (default disabled). Equivalent to specifying 'maven' in the list of templates.
-noant        Deprecated. Do not create an ant configuration file. Equivalent to not specifying 'ant' in the list of templates.
and
moduleName  The name of the module to create (e.g. com.example.myapp.MyApp)
如果要创建一个纯净的maven project,要用到-maven参数,还要指定GWT module name。

先创建你的项目目录,例如gwtmavenproject
在目录中运行:webAppCreator -maven com.martian.gwtmavenproject.MainPanel,com.martian.gwtmavenproject.MainPanel是moduleName,com.martian.gwtmavenproject是entry-point
module的位置,同时pom文件也以com.martian.gwtmavenproject作为groupId、MainPanle作为artifactId
可能你需要修改一下pom文件中的groupId和artifactId

2. 使用Mave GWT Plugin创建maven project

假设我们要创建一个maven project,有以下条件
groupId=com.martian
artifactId=gwtmavenproject
version=1.0
gwtModuleName=MainPanel

运行
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0 -DgroupId=com.martian -DartifactId=gwtmavenproject -Dversion=1.0-SNAPSHOT -Dmodule=MainPanel -DinteractiveMode=false


注意:
请注意,WebAppCreator -maven 已经被丢弃,不推荐使用!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: