将SmartGWT 4.0示例项目迁移到Maven

3
我目前正在尝试通过Eclipse将smartGWT 4.0示例项目BuiltinDS迁移到Maven,具有以下特征:
  • Smartgwt版本为4.0-pro
  • GWT版本为2.8.1
  • JDK Java 1.8
  • Eclipse版本为2021-03
  • SmartGWT库在NEXUS中

enter image description here

enter image description here

enter image description here

enter image description here

这是我发现的应该具备依赖关系的 Pom。

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>builtinds</groupId>
  <artifactId>builtinds</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <dependencies>
  
           <!-- Standard GWT depdendency -->
           <dependency>
               <groupId>com.google.gwt</groupId>
               <artifactId>gwt-user</artifactId>
               <version>2.8.1</version>
               <scope>provided</scope>
           </dependency>
           
            <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-servlet -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-servlet</artifactId>
                <version>2.8.1</version>
                <scope>provided</scope>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-dev -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-dev</artifactId>
                <version>2.8.1</version>
                <scope>provided</scope>
            </dependency>
            
            
            <!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
            </dependency>
    
           <!-- The SmartGWT Evaluation edition -->
           <dependency>
               <groupId>com.isomorphic.smartgwt.pro</groupId>
               <artifactId>smartgwt-pro</artifactId>
               <version>4.0-focuss</version>
               <exclusions>
                    <!-- Exclusion: required to avoid conflicting with the asm dependency below -->
                    <exclusion>
                        <groupId>asm</groupId>
                        <artifactId>asm</artifactId>
                    </exclusion>
                </exclusions>
           </dependency>
    
           <!-- Add support for SQLDataSources -->
           <dependency>
               <groupId>com.isomorphic.smartgwt.pro</groupId>
               <artifactId>isomorphic-sql</artifactId>
               <version>4.0-focuss</version>
           </dependency>
           
           <!-- only_for_building\log4j\log4j-1.2.15.jar -->
            <!-- https://mvnrepository.com/artifact/log4j/log4j -->
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/org.hsqldb/hsqldb --> 
            <dependency>
                <groupId>org.hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
                <version>2.2.9</version>
            </dependency>   
            
            <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.3</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
            <dependency>
                <groupId>commons-collections</groupId>
                <artifactId>commons-collections</artifactId>
                <version>3.2.1</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>1.3</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-dbcp2</artifactId>
                <version>2.0</version>
            </dependency>       
            
            
            <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi-ooxml</artifactId>
                <version>3.9</version>
            </dependency>
            
            <!-- Logging: Slf4j -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>1.7.7</version>
            </dependency>
        
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.7</version>
            </dependency>       
            
            <!-- https://mvnrepository.com/artifact/commons-jxpath/commons-jxpath -->
            <dependency>
                <groupId>commons-jxpath</groupId>
                <artifactId>commons-jxpath</artifactId>
                <version>1.3</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/oro/oro -->
            <dependency>
                <groupId>oro</groupId>
                <artifactId>oro</artifactId>
                <version>2.0.6</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/com.smartgwt/smartgwt-skins -->
            <dependency>
                <groupId>com.smartgwt</groupId>
                <artifactId>smartgwt-skins</artifactId>
                <version>2.5</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.4</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/commons-pool/commons-pool -->
            <dependency>
                <groupId>commons-pool</groupId>
                <artifactId>commons-pool</artifactId>
                <version>1.4</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi</artifactId>
                <version>3.9</version>
            </dependency>   
            
            <!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-maven-plugin -->
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.4.19.v20190610</version>
            </dependency>       
    
       
    </dependencies>
       
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      
      <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>gwt-maven-plugin</artifactId>
           <version>2.8.1</version>
           <executions>
                  <execution>
                      <goals>
                          <goal>compile</goal>
                      </goals>
                  </execution>
           </executions>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.0.0</version>
     </plugin>
    </plugins>
  </build>
</project>

这是BuiltInDS.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.1//EN"
   "http://www.gwtproject.org/doctype/2.6.1/gwt-module.dtd">
<module rename-to="builtinds">
    <inherits name='com.google.gwt.user.User'/>
    <inherits name="com.smartgwt.tools.SmartGwtTools"/>
    <inherits name="com.smartgwtee.tools.Tools"/>
    <inherits name="com.smartgwtee.SmartGwtEE"/>

    <!-- Other module inherits -->
    <!-- 1) Add SmartGWT module -->
    <inherits name="com.smartgwt.SmartGwt"/>
    
    <set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
    
    <entry-point class='com.smartgwt.sample.client.BuiltInDS'/>
</module>

这是BuiltInDS.html

<!DOCTYPE html>

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <!--                                           -->
    <!-- Any title is fine                         -->
    <!--                                           -->
    <title>BuiltInDS</title>
    
    <!-- IMPORTANT : You must set the variable isomorphicDir to [MODULE_NAME]/sc/ so that the SmartGWT resource are 
      correctly resolved -->    
    <script> var isomorphicDir = "builtinds/sc/"; </script>
    
    <!--                                           -->
    <!-- This script loads your compiled module.   -->
    <!-- If you add any GWT meta tags, they must   -->
    <!-- be added before this line.                -->
    <!--                                           -->      
    <script type="text/javascript" language="javascript" src="builtinds/builtinds.nocache.js"></script>

    <!-- The following script is required if you're running (Super)DevMode and are using module
         definitions that contain <script> tags.  Normally, this script is loaded automatically
         by builtinds.nocache.js above, but this isn't possible when (Super)DevMode is running.
         Note: it should not create any issue to always load it below (even if already loaded). -->
    <script type="text/javascript" language="javascript" src="builtinds/loadScriptTagFiles.js"></script>

    <script src="builtinds/sc/modules/ISC_Core.js"> </script>
    <script src="builtinds/sc/modules/ISC_Foundation.js"> </script>
    <script src="builtinds/sc/modules/ISC_Containers.js"> </script>
    <script src="builtinds/sc/modules/ISC_Grids.js"> </script>
    <script src="builtinds/sc/modules/ISC_Forms.js"> </script>
    <script src="builtinds/sc/modules/ISC_RichTextEditor.js"></script>
    <script src="builtinds/sc/modules/ISC_Calendar.js"> </script>
    <script src="builtinds/sc/modules/ISC_DataBinding.js"> </script>
    <script src="builtinds/sc/skins/Enterprise/load_skin.js"></script>

  </head>

  <!--                                           -->
  <!-- The body can have arbitrary html, or      -->
  <!-- you can leave the body empty if you want  -->
  <!-- to create a completely dynamic UI.        -->
  <!--                                           -->
  <body>

    <!--load the datasources-->
    <script src="builtinds/sc/DataSourceLoader?dataSource=supplyItem,animals,employees,bufferTable,bufferHistoryTable"></script>

    <!-- OPTIONAL: include this if you want history support -->
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>

  </body>
</html>


编译成功,但当我运行GWT开发模式(CodeServer)的配置时,控制台会给出以下提示,应用程序无法启动。 在此输入图片描述

enter image description here

1个回答

0

我几个月前遇到了类似的问题,当时我在一个与你类似的项目上工作,但没有使用Maven。

对于我的问题,应该归咎于Eclipse版本。似乎在2020-06之后的任何Eclipse版本都无法使用实际的Java 8启动您的Java 8 - GWT项目。您写道您正在使用2021-03,我建议您尝试将Eclipse降级到版本2020-06。

我在Eclipse 2020-06上测试了我的项目,使用了GWT 2.8.1和GWT 2.9.0,它们都运行得非常好。

希望我能有所帮助!

Luke


1
嗨,我尝试在不同版本的Eclipse中,包括2020-03、2020-06和2021-03,在每个版本中都得到了相同的结果。 - Norida Olivera

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