0

StackOverflow ユーザーの皆様へ

SmartGWT で作成され、maven でコンパイルされた巨大なアプリケーションを、共通、カスタム ウィジェット、フォーム、カスタム データソース、サイトなどのいくつかのサブプロジェクトに分割したいと考えています。

主なアイデアは次のとおりです。サブプロジェクトが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>
    <parent>
        <groupId>eu.nanobeauty</groupId>
        <artifactId>nanobeauty</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>common</artifactId>
    <packaging>jar</packaging>
    <name>nanoBeauty :: Common</name>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Common.gwt.xmlは :

<module>
    <inherits name="com.google.gwt.user.User"/>
    <inherits name="com.smartgwt.SmartGwtNoTheme"/>
    <source path="common"/>
</module>

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>eu.nanobeauty</groupId>
    <artifactId>nanobeauty</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>nanoBeauty :: Parent</name>

    <modules>
        <module>datasources</module>
        <!-- multimodule : each form different project -->
        <module>forms</module>
        <!-- multimodule : each site different project -->
        <module>sites</module>
        <module>common</module>
    </modules>

    <properties>
        <gwt.version>2.5.0</gwt.version>
        <smartgwt.version>3.1</smartgwt.version>
        <java.version>1.6</java.version>
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.war.plugin.version>2.1.1</maven.war.plugin.version>
    </properties>

    <repositories>
        <repository>
            <id>smartclient</id>
            <url>http://smartclient.com/maven2</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.smartgwt</groupId>
            <artifactId>smartgwt</artifactId>
            <version>${smartgwt.version}</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>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
4

1 に答える 1

0

長い夜のグーグルの後、私は解決策を見つけました:

私が達成したいこの方法ではできません。

GWT は、JS ファイルを生成するためにソース ファイルを必要とします。メインモジュールpom.xmlは問題ありません。上記のサンプル.gwt.xmlファイルも問題ありません。変更のみがサブモジュールpom.xmlファイルにあり、目標はresources.

したがって、すべてのサブモジュールについて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>
    <parent>
        <groupId>eu.nanobeauty</groupId>
        <artifactId>nanobeauty</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>common</artifactId>
    <packaging>jar</packaging>
    <name>nanoBeauty :: Common</name>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

この文書に基づいて:

于 2013-02-16T10:49:33.437 に答える