1

我将一个 gwt 项目转换为使用 maven。我们使用'war'作为我们输出put的目录。这是一个好主意吗?

在这个目录中,我们还有 css、html 和 javascript 文件。

现在,当我从 Eclipse 中运行项目时,html、js 等都消失了。如果我把文件放回去,就会再次被删除。基本上,我如何设置我们的项目,以便我们可以拥有我们的 js、图像、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>

4

1 回答 1

0

我们坚持为 webapp 项目使用默认的 maven 布局。

src/main/java
src/main/webapp
src/main/resources

参考 - https://developers.google.com/eclipse/docs/faq#gwt_with_maven

还要始终检查您的 pom.xml wrt 以从 GWT 团队中取样。只需将 gwt-maven-plugin 更新到最新的 2.5.0 -

1)验证

2) Dynatablerf

3)移动网络应用

于 2013-01-14T17:09:04.617 回答