GWT 2.5.1 mvn 安装错误"重新绑定结果<class>必须是类"



问题:我在使用 gwt-maven-plugin 构建的 GWT 2.5.1 项目上运行 mvn gwt:compile,并得到错误重新绑定结果必须是我拥有的所有扩展 CssResource 的类中的类。

此类是其中之一:

public interface MainShellStyle extends CssResource{
    public static final MainShellStyle INSTANCE =  GWT.create(MainShellStyle.class);
    public String txtCompanyName();
    public String txtCompanySlogan();
    public String txtCompanyMessage();
    public String topRibbon();
    public String mainMenu();
    public String btnEditContacts();
    public String btnEditGuestBook();
    public String btnEditPictures();
    public String btnEditHome();
}

我的pom.xml如下:

<!-- Dependecies --!>
<build>
        <!-- Generate compiled stuff in the folder used for development mode -->
        <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
        <!-- Plugins -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archiveClasses>true</archiveClasses>
                    <webResources>
                        <!-- in order to interpolate version from pom into appengine-web.xml -->
                        <resource>
                            <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                            <filtering>true</filtering>
                            <targetPath>WEB-INF</targetPath>
                        </resource>
                        <resource>
                            <directory>${basedir}/src/main/webapp/js</directory>
                            <filtering>false</filtering>
                            <targetPath>js</targetPath>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.version}</version>
                <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                    documentation at codehaus.org -->
                <configuration>
                    <!-- URL that should be automatically opened in the GWT shell (gwt:run). -->
                    <runTarget>Webmetalmore.html</runTarget>
                    <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
                    <compileReport>true</compileReport>
                    <module>com.ohapp.webmetalmore.Webmetalmore</module>
                    <logLevel>INFO</logLevel>
                    <style>${gwt.style}</style>
                    <copyWebapp>true</copyWebapp>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <version>${gwt.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <version>${gwt.version}</version>
                    </dependency>
                </dependencies>
                <!-- JS is only needed in the package phase, this speeds up testing -->
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <!-- End Plugins -->
    </build>

这是我第一次编译GWT项目。我做错了什么?

谢谢。

您无法GWT.create() CssResource接口,您必须从您将GWT.create() ClientBundle引用它。与 CSS 文件的关联是通过 ClientBundle 方法建立的。

见 http://www.gwtproject.org/doc/latest/DevGuideClientBundle.html

相关内容

最新更新