Pas*_*ent 42
编辑:我已经通过OP提供的其他步骤更新了我的答案.有关详细信息,请致OP.
我刚刚破坏了我的Eclipse设置,尝试安装最新版本的Google Plugin for Eclipse(适用于GWT 2.0),所以我无法确认所有内容,但我们假设满足以下先决条件:
你试过:
从Eclipse创建一个新项目(New> Other ...然后选择Maven Project并选择gwt-maven-plugin archetype).
编辑生成的pom.xml
,更新gwt.version
属性2.0.0
(已在中央存储库中发布),添加Codehaus Snapshot存储库并将gwt-maven-plugin
版本设置为1.2-SNAPSHOT
(版本1.2未在中央发布,这应该很快1.2
发布)(已发布)在中央也).
添加<runTarget>
到gwt-maven-plugin配置,如使用Google Eclipse插件中所述.
按照上一步中提到的页面中的说明配置maven-war-plugin.
通过设置使用Google Web Toolkit复选框从项目首选项手动启用项目上的GWT此步骤是不必要的,因为您将使用Maven运行配置而不是Eclipse的GWT插件构建/运行.
这就是我的pom.xml
实际情况:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!--
GWT-Maven archetype generated POM
-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.demo</groupId>
<artifactId>my-gwtapp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>gwt-maven-archetype-project</name>
<properties>
<!-- convenience to define GWT version in one place -->
<gwt.version>2.0.0</gwt.version>
<!-- tell the compiler we can use 1.5 -->
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
</properties>
<dependencies>
<!-- GWT dependencies (from central repo) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>com.mycompany.demo.gwt.Application/Application.html</runTarget>
</configuration>
</plugin>
<!--
If you want to use the target/web.xml file mergewebxml produces,
tell the war plugin to use it.
Also, exclude what you want from the final artifact here.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>target/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
运行gwt:eclipse
目标(使用m2eclipse Maven2> build ...)来设置环境并为GWT模块创建启动配置.
运行gwt:compile gwt:run
以在GWT托管模式下编译和运行GWT模块.
归档时间: |
|
查看次数: |
32309 次 |
最近记录: |