如何让GWT与Grails 3一起工作 [英] how to get GWT work with Grails 3

查看:115
本文介绍了如何让GWT与Grails 3一起工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Grails最新版本,即3.1.3和GWT



我已经浏览了gwt / grails插件及其教程,但所有这些都是为了旧版本的Grails,我们有BuildConfig.groovy,格式看起来不同。

现在,我们有build.gradle,我找不到一种方法把gwt插件那里

我试过的是:添加

  compile org.grails.plugins:gwt:1.0.2

现在当我运行命令时:

  grails create-gwt-module 

我得到异常:

 无法解析配置':runtime'的所有依赖关系。 
>找不到org.grails.plugins:资源:1.2。
在以下位置搜索:
file:/ C:/Users/Junaid/.m2/repository/org/grails/plugins/resources/1.2/r
sources-1.2.pom
文件:/ 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/资源/1.2/re
资源-1.2.zip
要求:
helloworld2:helloworld2:0.1> org.grails.plugins:gwt:1.0.2

这是我的build.gradle:

  buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven {urlhttps://repo.grails.org/grails/core}
}
依赖关系{
classpathorg.grails: grails-gradle-plugin:$ grailsVersion
classpathcom.bertramlabs.plugins:asset-pipeline-gradle:2.5.0
classpathorg.grails.plugins:hibernate4:5.0.2
}

}



<$ p $
grouphelloworld2

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
}

repositori es {
mavenLocal()
maven {urlhttps://repo.grails.org/grails/core}
}

dependencyManagement {
进口{
mavenBomorg.grails:grails-bom:$ grailsVersion
}
applyMavenExclusions false
}

依赖关系{
编译org.springframework.boot:spring-boot-starter-logging
编译org.springframework.boot:spring-boot-autoconfigure
compileorg.grails:grails-core
编译org.springframework.boot:spring-boot-starter-actuator
compileorg.springframework.boot:spring-boot-starter-tomcat
compileorg.grails:grails-依赖关系
compileorg.grails:grails-web-boot
compileorg.grails.plugins:cache
compileorg.grails.plugins:scaffolding
编译org.grails.plugins:hibernate4
compileorg.hibernate:hibernate-ehcache
compileorg.grails.plugins:gwt:2.6.0
consoleorg。 grails:grails-console
profileorg.grails.profiles:web:3.1.3
runtimeorg.grails.plugin s:asset-pipeline
runtimecom.h2database:h2
testCompileorg.grails:grails-plugin-testing
testCompileorg.grails.plugins:geb
testRuntimeorg.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1
testRuntimenet.sourceforge.htmlunit:htmlunit:2.18
}

任务包装(类型:包装){
gradleVersion = gradleWrapperVersion
}

资产{
minifyJs = true
minifyCss = true
}


解决方案

您是否试图获得 compile org.grails.plugins:gwt:1.0.3最新版本的插件

一>?


如果无法自动下载,请从 repo 并将其放入本地maven存储库中的搜索位置之一? 官方插件文档您可以阅读:


在Grails 2.x插件中打包为ZIP文件,但是在Grails中
3.x插件是可以添加到IDE的类路径中的简单JAR文件。


因此,按照官方部署文档


在Grails 3.0或更高版本中部署的另一种方式是对可运行的JAR或WAR文件使用新的
支持。要创建可运行的存档,
运行grails包:

grails包



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
}

解决方案

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

这篇关于如何让GWT与Grails 3一起工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆