在项目源代码或资源中找不到 GWT 模块 XXX。

3
我已经使用Maven的vaadin:update-widgetset和gwt:compile目标编译了小部件集。所以pom.xml和web.xml文件的配置应该没问题。
我是一个Maven新手,这是我的第一个Maven项目。
编译后,编译代码显示在src/main/webapp/VAADIN/widgetsets文件夹中。当我尝试运行install目标时,错误显示:
无法执行org.codehaus.mojo:gwt-maven-plugin:2.2.0:resources(默认)对Validation-Manager-Web项目的GWT模块com.pantar.widget.graph.GraphWidget未在项目源或资源中找到。
为了避免不必要的麻烦,以下是相关文件:
POM:
        <plugins>
            <!-- Compiles your custom GWT components with the GWT compiler -->
            <!-- A hosted mode browser for client-side widget debugging can be run with the goal gwt:run after uncommenting the 
            correct line below. A remote debugger can then be connected to port 8998. Note that e.g. a Jetty server should be running 
            with the server side parts - use the goal jetty:run . -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.plugin.version}</version>
                <configuration>
                    <!-- if you don't specify any modules, the plugin will find them -->
                    <modules> 
                        <module>com.pantar.widget.graph.GraphWidget</module> 
                    </modules>
                    <webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>
                    <!-- On Mac running Snow Leopard, add "-d32" -->
                    <!-- This causes error messages (but build works) in phase "package": two processes would use the same debug 
                    port -->
                    <!--extraJvmArgs>-Xmx512M -Xss1024k -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8998</extraJvmArgs -->
                    <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                    <runTarget>Validation-Manager-Web</runTarget>
                    <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                    <noServer>true</noServer>
                    <port>8084</port>
                    <compileReport>false</compileReport>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>resources</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <version>${gwt.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <version>${gwt.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>1.0.2</version>
                <executions>
                    <execution>
                        <configuration>
                            <modules> 
                                <module>com.pantar.widget.graph.GraphWidget</module> 
                            </modules>
                        </configuration>
                        <goals>
                            <goal>update-widgetset</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

有什么想法吗?

提前感谢你!


我一直在思考,我觉得我需要把那些文件放在资源文件夹里。明天早上我会尝试一下。 - javydreamercsw
很遗憾,那并没有使其工作。 - javydreamercsw
1个回答

2

通过添加一个空的gwt.xml文件来解决它,其内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />

    <inherits name="<module>" />
</module>

真的吗?继承标记在你这里起作用了吗?我只从Maven得到解析异常。 - bpawlowski
是的,确实如此。请记住,有些东西似乎不对,比如 <?xml version="1.0" encoding="UTF-8"?> 可能应该是 <xml version="1.0" encoding="UTF-8"/> 在发布时格式可能出了问题。 - javydreamercsw

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接