【问题标题】:Migrate SmartGWT 4.0 sample project to Maven将 SmartGWT 4.0 示例项目迁移到 Maven
【发布时间】:2022-07-19 03:24:10
【问题描述】:

我目前正在尝试通过 Eclipse 将名为 BuiltinDS 的 smartGWT 4.0 示例项目迁移到 Maven,具有以下特点:

  • Smartgwt 4.0-pro 版
  • GWT 版本 2.8.1
  • JDK java 1.8
  • Eclipse 版本 2021-03
  • SmartGWT 库位于 NEXUS 中

这是我发现它应该具有依赖项的 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) 类型的配置时,控制台给了我以下信息并且应用程序没有启动。

发布更新

首先,我尝试使用 mvn 命令中的archetype-smartgwt-example-builtinds 描述here 的原型创建示例环境(BuiltInDs),但它没有工作......那些原型似乎被弃用。

然后,我尝试了另一种方法,从 Eclipse 创建了一个 maven 项目,寻找 SmartGWT 原型,最后,我能够创建并运行 SmartGWT 示例项目(其中包括按钮等基本图形元素)以下特点:

  • SmartGWT 版本 6.1-p20200412
  • GWT 版本 2.8.0
  • JDK java 1.8.0_241
  • Apache Maven 3.6.3
  • Eclipse 版本 2021-03

这就是项目结构的样子。

为了运行项目,我使用以下两种配置:

另外,我附上了我在项目中使用的文件:

在已经配置环境的情况下,我想在thesethese 指示之后添加数据源。 Run_basicenv 和 Debug_BasicEnv 配置都执行成功,但是没有显示数据源文件(bufferTable.ds.xml)的信息。

之后,我尝试使用 Visual Builder 工具检查数据源,但收到此错误消息(请参阅Error.txt 文件中的详细信息):

HTTP ERROR 500
Problem accessing /com.focuss.basicenv.Application/tools/visualBuilder/index.jsp. Reason:

    Server Error
Caused by:
org.apache.jasper.JasperException: An exception occurred processing JSP page /com.focuss.basicenv.Application/tools/visualBuilder/index.jsp at line 103

100: <isomorphic:loadSystemSchema/>
101: 
102: // load FileSources
103: <isomorphic:loadDS ID="vbScreens,vbSettings,vbProjects,vbDataSources" />
104: </SCRIPT>
105: 
106: <!-- load Tools resources -->


Stacktrace:
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:405)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:349)
    at org.eclipse.jetty.jsp.JettyJspServlet.service(JettyJspServlet.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.NoClassDefFoundError: org/apache/commons/jxpath/ri/model/NodePointerFactory    

目前我只能访问该版本的 SmartGWT,因此如果您能帮我弄清楚我可能缺少哪些设置或依赖项,那将非常有帮助。

非常感谢您。

【问题讨论】:

    标签: java maven java-8 java-11 smartgwt


    【解决方案1】:

    几个月前,我在一个与您类似的项目中遇到了类似的问题,但没有 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 测试了我的项目,它们都运行良好。

    希望对我有所帮助!

    卢克

    【讨论】:

    • 嗨,我在 2020-03、2020-06 和 2021-03 尝试了不同版本的 Eclipse,每次都得到相同的结果。
    猜你喜欢
    • 2015-09-21
    • 2020-09-29
    • 1970-01-01
    • 2014-11-02
    • 1970-01-01
    • 2020-04-08
    • 1970-01-01
    • 1970-01-01
    • 2011-05-09
    相关资源
    最近更新 更多