how to get GWT work with Grails 3

帅比萌擦擦* 提交于 2020-01-17 05:02:13

问题


I am using Grails latest version i.e 3.1.3, and GWT

I have gone through the gwt/grails plugin and their tutorials , but All of this is for old version of grails , where we had "BuildConfig.groovy" and the format looks different.

Now as we have build.gradle , I cant find a way to put gwt plugin there

What i have tried is : adding

         compile "org.grails.plugins:gwt:1.0.2"

now when i run command:

           grails create-gwt-module

I get the exception:

            Could not resolve all dependencies for configuration ':runtime'.
 > Could not find org.grails.plugins:resources:1.2.
Searched in the following locations:
    file:/C:/Users/Junaid/.m2/repository/org/grails/plugins/resources/1.2/r
 sources-1.2.pom
    file:/C:/Users/Junaid/.m2/repository/org/grails/plugins/resources/1.2/r
 sources-1.2.zip
    https://repo.grails.org/grails/core/org/grails/plugins/resources/1.2/re
 ources-1.2.pom
    https://repo.grails.org/grails/core/org/grails/plugins/resources/1.2/re
  ources-1.2.zip
Required by:
    helloworld2:helloworld2:0.1 > org.grails.plugins:gwt:1.0.2

this is my build.gradle:

buildscript {
ext {
    grailsVersion = project.grailsVersion
}
repositories {
    mavenLocal()
    maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
    classpath "org.grails:grails-gradle-plugin:$grailsVersion"
    classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.5.0"
    classpath "org.grails.plugins:hibernate4:5.0.2"
}

}

 version "0.1"
 group "helloworld2"

  apply plugin:"eclipse"
  apply plugin:"idea"
  apply plugin:"war"
  apply plugin:"org.grails.grails-web"
  apply plugin:"org.grails.grails-gsp"
  apply plugin:"asset-pipeline"

  ext {
  grailsVersion = project.grailsVersion
  gradleWrapperVersion = project.gradleWrapperVersion
 }

 repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}

dependencyManagement {
imports {
    mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}

dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:hibernate4"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:gwt:2.6.0"
console "org.grails:grails-console"
profile "org.grails.profiles:web:3.1.3"
runtime "org.grails.plugins:asset-pipeline"
runtime "com.h2database:h2"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
 }

 task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}

assets {
minifyJs = true
minifyCss = true
}

回答1:


Did you try to get compile "org.grails.plugins:gwt:1.0.3", the latest version of plugin?

And if it can't be downloaded automatically to download it manually from repo and put in one of searched locations in your local maven repository?

In official plugin docs you can read:

In Grails 2.x plugins were packaged as ZIP files, however in Grails 3.x plugins are simple JAR files that can be added to the classpath of the IDE.

So try to pack plugin to jar according to official deployment docs:

Another way to deploy in Grails 3.0 or above is to use the new support for runnable JAR or WAR files. To create runnable archives, run grails package:

grails package



来源:https://stackoverflow.com/questions/35822526/how-to-get-gwt-work-with-grails-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!