How to migrate gwt 2.8.1 project to gwt 2.9.0 in eclipse?

318 views
Skip to first unread message

mb user

unread,
Jul 28, 2020, 11:42:30 AM7/28/20
to GWT Users
Hi,

After a storage crash, I had to reinstall my development computer.

Now I have eclipse 4.16 and a gwt 2.8.1 project source imported from svn.

This project was built with the eclipse gwt plugin, but I cannot install it to eclipse 4.16.

What is the recommended way to achieve compile and deploy (create war file) in eclipse, if you have the project source?



Michael Conrad

unread,
Jul 28, 2020, 11:46:07 AM7/28/20
to google-we...@googlegroups.com
Use Maven or Gradle to configure the project and let Eclipse import it as a Maven or Gradle project.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/b10ca891-b6d0-4fdf-a2ee-e0296cb03fc2o%40googlegroups.com.

mb user

unread,
Jul 28, 2020, 1:53:39 PM7/28/20
to GWT Users
I imported the project from svn, then eclipse created a new gradle project.

It seems like gradle recognize this project as a normal java project.

I have only src and war directories in the repository, so no files in the root dir.
In the src there are numerous gwt modules directories, and in the war, there are html/css static files for gwt modules and in the WEB-INF dir:

c:\p\eclipse\fejlesztoi2>dir /b /s  "war/WEB-INF"
c:\p\eclipse\fejlesztoi2\war\WEB-INF\glassfish-web.xml
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib
c:\p\eclipse\fejlesztoi2\war\WEB-INF\web.xml
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\activation.jar
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\commons-fileupload-1.2.1.jar
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\gchart.jar
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\gwt-ajaxloader.jar
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\gwt-maps-api-3.10.0-alpha-8-SNAPSHOT.jar
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\gwt-servlet.jar
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\javax.xml.soap-api-1.4.0.jar
c:\p\eclipse\fejlesztoi2\war\WEB-INF\lib\mail.jar


what's next?


On Tuesday, July 28, 2020 at 5:46:07 PM UTC+2, Michael Conrad wrote:
Use Maven or Gradle to configure the project and let Eclipse import it as a Maven or Gradle project.

On Tue, Jul 28, 2020 at 11:42 AM mb user <muse...@gmail.com> wrote:
Hi,

After a storage crash, I had to reinstall my development computer.

Now I have eclipse 4.16 and a gwt 2.8.1 project source imported from svn.

This project was built with the eclipse gwt plugin, but I cannot install it to eclipse 4.16.

What is the recommended way to achieve compile and deploy (create war file) in eclipse, if you have the project source?



--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsub...@googlegroups.com.

Michael Conrad

unread,
Jul 28, 2020, 2:51:02 PM7/28/20
to google-we...@googlegroups.com
We use a build.gradle file similar to the following for most of our GWT client projects:

(Note: We use './gradlew :gwts' to run SDM and './gradlew :build :farmRun' to run a local http server)

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'gwt'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.gretty'
apply plugin: 'maven'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
    tasks.withType(JavaCompile) {
        options.compilerArgs.addAll(["--release", "8"])
    }
}

compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

farm {
  webapp ':'
}

buildscript {
    repositories {
        jcenter()
        maven { url 'https://repo.spring.io/plugins-release' }
        maven { url "https://plugins.gradle.org/m2/" }
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'org.wisepersist:gwt-gradle-plugin:1.+'
        classpath "gradle.plugin.org.gretty:gretty:3.0.3"
    }
}

war {
    archiveName 'client.war'
    rootSpec.exclude('WEB-INF/classes/**/*.class')
    rootSpec.exclude('WEB-INF/classes/**/*.gwt.xml')
}

gretty {
    httpPort = 8080;
    servletContainer = 'tomcat9'
    managedClassReload = false
    reloadOnClassChange = false
    extraResourceBase 'build/gwt/out'
    jvmArgs = ['-Dfile.encoding=UTF-8', '-Xmx2048M', '-Ddebug=true' ]
    redeployMode='redeploy'
}

repositories {
    jcenter()
    maven { url 'https://jitpack.io' }
}

gwt {
    logLevel = 'INFO'

    maxHeapSize = "8192M";

    //gwtVersion='2.8.2'
    gwtVersion='2.9.0'

    modules 'com.project.Module'
   
    compiler {
        disableClassMetadata = false;
        strict = true;
        style = "OBF";
        //style = "PRETTY";
        localWorkers = 4;
    }

    superDev {
        noPrecompile = true;
        failOnError = false;
        bindAddress = "0.0.0.0";
    }
   
    eclipse {
        addGwtContainer = true;
    }
}
 
configurations {
  provided
}

dependencies {
    gwt 'com.google.gwt:gwt-user:'+gwt.gwtVersion
    providedCompile 'com.google.gwt:gwt-servlet:'+gwt.gwtVersion
   
    gwt 'com.google.elemental2:elemental2-dom:1.0.0'
    gwt 'com.google.elemental2:elemental2-core:1.0.0'
    gwt 'com.google.elemental2:elemental2-promise:1.0.0'
    gwt 'com.ekotrope:gwt-completablefuture:1.0.0'
   
    providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
    compile 'javax.ws.rs:javax.ws.rs-api:2.1.1'
   
    gwt 'org.fusesource.restygwt:restygwt:2.2.+'
    gwt "com.fasterxml.jackson.core:jackson-annotations:2.9.6"
    gwt "com.fasterxml.jackson.core:jackson-databind:2.9.6"
    gwt 'com.google.code.findbugs:jsr305:3.0.0' //required for restygwt compile
    gwt 'com.github.nmorel.gwtjackson:gwt-jackson:0.15.2'
   
    gwt ('com.google.gwt.eventbinder:eventbinder:1.1.0') {
        //exclude module: 'gwt-user'
    }
   
    gwt 'javax.xml.bind:jaxb-api:2.3.+'
}

task "create-dirs" {
    doLast{
    sourceSets*.java.srcDirs*.each { it.mkdirs() }
    sourceSets*.resources.srcDirs*.each { it.mkdirs() }
}}

eclipseJdt {
    doLast{
    File f = file('.settings/org.eclipse.core.resources.prefs')
    f.write('eclipse.preferences.version=1\n')
    f.append('encoding/<project>=utf-8')
    f = file('.settings/org.eclipse.core.runtime.prefs')
    f.write('eclipse.preferences.version=1\n')
    f.append('line.separator=\\n\n')
}}

eclipse {
    project {
        name = 'My Project'
        webAppDirName = 'src/main/webapp'
    }

    classpath {
        downloadSources = true
        downloadJavadoc = true
    }

    jdt {
        sourceCompatibility=1.8
        targetCompatibility=1.8
    }

    wtp {
        facet {
            facets = []
            facet name: 'jst.java', version: '1.8'
            facet name: 'jst.web', version: '3.0'
            facet name: 'com.gwtplugins.gwt.facet', version: '1.0'
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/60e9fd36-d19e-400b-905a-19f8ba068d16o%40googlegroups.com.

mb user

unread,
Jul 29, 2020, 9:14:51 AM7/29/20
to GWT Users

Thank You Michael!

It was a big help.

Except the :farmRun I can successfully execute the commands.

:farmRun give me an interesting "java.util.zip.ZipException: zip file is empty" message. Any idea, what is this?

Full log:

gradlew :farmRun
j├║l. 29, 2020 3:07:27 DU org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
j├║l. 29, 2020 3:07:32 DU org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
j├║l. 29, 2020 3:07:32 DU org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.34]
j├║l. 29, 2020 3:07:32 DU org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@395b56bb]
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:468)
        at org.apache.catalina.startup.Tomcat$start$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
        at org.akhikhl.gretty.TomcatServerManager.startServer(TomcatServerManager.groovy:52)
        at org.akhikhl.gretty.ServerManager$startServer$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
        at org.akhikhl.gretty.Runner.run(Runner.groovy:129)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:70)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
        at org.akhikhl.gretty.Runner.main(Runner.groovy:54)
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@395b56bb]
        at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
        at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:727)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4805)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4940)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
        ... 36 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: zip file is empty
        at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:143)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        ... 48 more
Caused by: java.util.zip.ZipException: zip file is empty
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:225)
        at java.util.zip.ZipFile.<init>(ZipFile.java:155)
        at java.util.jar.JarFile.<init>(JarFile.java:166)
        at java.util.jar.JarFile.<init>(JarFile.java:130)
        at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:184)
        at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:169)
        at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:140)
        ... 49 more

Michael Conrad

unread,
Jul 29, 2020, 10:14:53 AM7/29/20
to google-we...@googlegroups.com
Reads like your war file is empty.

You *must* declare your dependencies via Gradle and if you are mixing server and client code, (a really bad idea), together you will need to remove the root spec exclude filters.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages