1

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>

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)ダイナテーブル

3)モバイルウェブアプリ

于 2013-01-14T17:09:04.617 に答える