我将gwt项目转换为使用maven。我们使用'war'作为我们输出的目录。这是一个好主意吗?
在这个目录中我们还有css,html和javascript文件。
现在,当我从eclipse中运行项目时,html,js等已经消失了。如果我把文件放回去,就会再次删除。 基本上,我如何设置我们的项目,以便我们可以拥有我们的js,image,css文件 - 而不是资源 - 而只是静态文件 - 并且在我们运行项目时不会删除它们,但仍然可以将它们提供给我们的gwt应用程序何时运行?
这是我的pom.xml。我希望你能帮助我。
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.magick.app</groupId>
<artifactId>com.magick.app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>magick.app</name>
<description>Magick.App</description>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>war\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- <version>2.5.0</version> 2.1.0-1 -->
<version>${gwt.version}</version>
<configuration>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>
gwt-maven-plugin
</artifactId>
<versionRange>
[2.4.0,)
</versionRange>
<goals>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>3.0</version>
</dependency>
<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>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-gwt-client</artifactId>
<version>1.0.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-gwt-server</artifactId>
<version>1.0.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.2.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.danvk</groupId>
<artifactId>dygraphs-gwt</artifactId>
<version>2011.04.18</version>
</dependency>
<!-- <dependency> <groupId>com.gwtplatform</groupId> <artifactId>gwtp-all</artifactId>
<version>0.8-alpha-2</version> </dependency> -->
<!-- MVP component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<!-- Dispatch component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-client</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope> <!-- Remove for GWTP 0.5.1 and earlier -->
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-server-guice</artifactId>
<!-- Or, if you use spring: <artifactId>gwtp-dispatch-server-spring</artifactId> -->
<!-- For GWTP 0.5.1 and earlier: <artifactId>gwtp-dispatch-server</artifactId> -->
<version>${gwtp.version}</version>
</dependency>
<!-- Crawler component -->
<!-- <dependency> <groupId>com.gwtplatform</groupId> <artifactId>gwtp-crawler</artifactId>
<version>${gwtp.version}</version> </dependency> -->
<!-- Annotation component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-processors</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<!-- Tester component -->
<!-- <dependency> <groupId>com.gwtplatform</groupId> <artifactId>gwtp-tester</artifactId>
<version>${gwtp.version}</version> <scope>test</scope> </dependency> -->
</dependencies>
<properties>
<gwtp.version>0.7</gwtp.version>
<gwt.version>2.4.0</gwt.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>sonatype</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
答案 0 :(得分:0)
我们坚持使用默认的maven布局进行webapp项目。
src/main/java
src/main/webapp
src/main/resources
参考 - https://developers.google.com/eclipse/docs/faq#gwt_with_maven
另外,请务必检查您的pom.xml w.r.t以获取GWT团队的样本。只需将gwt-maven-plugin更新到最新的2.5.0 -