Question

I did create a maven gwt project

 mvn archetype:generate -DarchetypeG
 roupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersi
 on=2.6.0 -DgroupId=com.domain.GwtMavenSpringHibernate -DartifactId=GwtMavenSprin
 gHibernate

I did import it to eclipse the right way after running

mvn eclipse:eclipse
mvn gwt:run

and they did run successfully

Here's my pom.xml

   <?xml version="1.0" encoding="UTF-8"?>
     <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/maven-v4_0_0.xsd">

 <!-- POM file generated with GWT webAppCreator -->
    <modelVersion>4.0.0</modelVersion>
   <groupId>com.domain.GwtMavenSpringHibernate</groupId>
       <artifactId>GwtMavenSpringHibernate</artifactId>
        <packaging>war</packaging>
         <version>1.0-SNAPSHOT</version>
      <name>GWT Maven Archetype</name>

       <properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.6.0</gwtVersion>
    <springframeworkVersion>3.1.2.RELEASE</springframeworkVersion>
    <!-- GWT needs at least java 1.5 -->
    <webappDirectory>${project.build.directory}/${project.build.finalName}             </webappDirectory>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-servlet</artifactId>
        <version>${gwtVersion}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>${gwtVersion}</version>
        <scope>provided</scope>
    </dependency>
    <!-- Spring framework distribution -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${springframeworkVersion}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${springframeworkVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${springframeworkVersion}</version>
    </dependency>
    <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> 
        <version>${springframeworkVersion}</version> </dependency> -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${springframeworkVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${springframeworkVersion}</version>
    </dependency>
    <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> 
        <version>${springframeworkVersion}</version> </dependency> <dependency> <groupId>org.springframework</groupId> 
        <artifactId>spring-aop</artifactId> <version>${springframeworkVersion}</version> 
        </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> 
        <version>${springframeworkVersion}</version> </dependency> -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${springframeworkVersion}</version>
    </dependency>
    <!-- Hibernate -->
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.1.4.Final</version>
    </dependency>
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>

    <!-- Databases Config -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.17</version>
    </dependency>

    <!-- Apache commons-logging -->
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>
    <!-- SLF4J -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.6</version>
    </dependency>
    <!-- Apache log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <!-- spring4gwt -->
    <dependency>
        <groupId>org.spring4gwt</groupId>
        <artifactId>spring4gwt</artifactId>
        <version>0.0.1</version>
        <scope>system</scope>
        <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/spring4gwt-0.0.1.jar</systemPath>
    </dependency>
    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <classifier>sources</classifier>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <!-- Generate compiled stuff in the folder used for developing mode -->
    <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
    <pluginManagement>
        <plugins>
            <!-- GWT Maven Plugin -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.6.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                        <goal>i18n</goal>
                        <goal>generateAsync</goal>
                    </goals>
                </execution>
            </executions>
            <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                documentation at codehaus.org -->
            <configuration>
                <runTarget>GwtSpringHibernate.html</runTarget>
                <hostedWebapp>${webappDirectory}</hostedWebapp>
                <i18nMessagesBundle>com.domain.GwtMavenSpringHibernate.client.Messages</i18nMessagesBundle>
            </configuration>
        </plugin>
            <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.6.0,)</versionRange>
                                    <goals>
                                        <goal>resources</goal>
                                        <goal>compile</goal>
                                        <goal>i18n</goal>
                                       <goal>generateAsync</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-war-plugin</artifactId>
                                    <versionRange>[3.2.1,)</versionRange>
                                    <goals>
                                        <goal>exploded</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>

                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>




        <!-- Copy static web files before executing gwt:run -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>exploded</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <webappDirectory>${webappDirectory}</webappDirectory>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
        </plugins>
        </pluginManagement>
</build>
<repositories>
    <repository>
        <id>maven2-repository.dev.java.net</id>
        <name>Java.net Repository for Maven</name>
        <url>http://download.java.net/maven/2/</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.release</id>
        <name>EBR Spring Release Repository</name>
        <url>http://repository.springsource.com/maven/bundles/release</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.external</id>
        <name>EBR External Release Repository</name>
        <url>http://repository.springsource.com/maven/bundles/external</url>
    </repository>
</repositories>

But in GwtMavenSpringHibernate Class those lines contain errors

private final Messages messages = GWT.create(Messages.class);
final Button sendButton = new Button(messages.sendButton() );
nameField.setText( messages.nameField() );


- Messages cannot be resolved to a type
- The method create(Class<?>) from the type GWT refers to the missing type 
 Messages .......

I can't figure out where the problem is ? Please help.

Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top