Grails 3.0 and Spring Security Error - grails

In my build.gradle I added this line of code
dependencies {
compile "org.grails.plugins:spring-security-core:3.0.3"
}
Then when I try to use it
import grails.plugin.springsecurity.annotation.Secured
#Secured('ROLE_ADMIN')
class SecureController {
def index() {
render 'Secure access only'
}
It "cannot resolve the symbol springsecurity"
I get the error
Error:(5, 1) Groovyc: unable to resolve class Secured , unable to find class for annotation
Any help would be much appreciated.
Build.gradle **** EDIT
This is the whole build.gradle file
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:hibernate:4.3.10.5"
}
}
plugins {
id "io.spring.dependency-management" version "0.5.4.RELEASE"
}
version "0.1"
group "securityrolesspring"
apply plugin: "spring-boot"
apply plugin: "war"
apply plugin: "asset-pipeline"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}
assets {
minifyJs = true
minifyCss = true
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
compile "org.grails.plugins:spring-security-core:3.0.3"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:scaffolding"
runtime "org.grails.plugins:asset-pipeline"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'
console "org.grails:grails-console"
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}

after 'apply plugin: "war"' add a line that says:
apply plugin: "maven"
in your repositories section, after "mavenLocal()" add a line that says:
mavenCentral()
this last recommendation is just cosmetic, but I would move your line:
compile "org.grails.plugins:spring-security-core:3.0.3"
and place it after the
compile "org.grails.plugins:scaffolding" line. it's good form to keep the initial set of grails dependencies pretty much as they are from the initial 'grails create-app' command. the exception to this rule is if you want to replace the logback logging with something else, but that's another story.
finally, you could also change your spring-security-core dependency to version 3.0.4 which is out now.

Spring security core has been updated the package location for #Secured Annotations. I use Grails 3.2.3 and Spring Security Core 3.1.1 int my project and works well. The following is the configuration the I used and is working as was in previos version of spring security core and Grails (2.X).
For installation, you have to add the entry in the dependencies block if your build.gradle file. Details in the oficial documentation for installation section for Spring Security Core
dependencies {
...
compile 'org.grails.plugins:spring-security-core:3.1.1'
...
To use the secured annotations in your controller, there were updates on the import (org.springframework.security.access.annotation.Secured) package and the #Secure annotation you have to assign to "value" the security statement you want to do. For example the annotation for #Secured('ROLE_ADMIN'), have to change like in the following example.
import org.springframework.security.access.annotation.Secured
#Secured(value=["hasRole('ROLE_ADMIN')"])
class SecureController {
def index() {
render 'Secure access only'
}
Detailed configuration are in the oficial documentation page, updates for secured annotation in version 3, and how to define secured annotations.

By importing
import grails.plugin.springsecurity.annotation.Secured
you will be able to resolve your problem.
It will again say that it cannot resolve symbol "Secured" but you need to ignore it because the code will run completely according to your expectation.

Related

Geb-Spock using wrong Groovy version

When I try to create a functional test using:
grails create-functional-test acceptance.tests.Logout
I'm getting this error, because Spock tries to use a wrong Groovy version:
| Error Failed to compile GenerateAsyncController.groovy: startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/reinaldoluckman/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/2.0-M2-groovy-3.0/396867de1bbbe11e85e197c22f0e6de07643185a/spock-core-2.0-M2-groovy-3.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 2.0.0-M2-groovy-3.0 is not compatible with Groovy 2.5.6. For more information, see http://docs.spockframework.org
Spock artifact: file:/Users/reinaldoluckman/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/2.0-M2-groovy-3.0/396867de1bbbe11e85e197c22f0e6de07643185a/spock-core-2.0-M2-groovy-3.0.jar
Groovy artifact: file:/Users/reinaldoluckman/.sdkman/candidates/grails/4.0.4/lib/org.codehaus.groovy/groovy/jars/groovy-2.5.6.jar
But in my project only Groovy 3 is a library.
Here is my build.gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:3.2.5"
classpath "org.grails.plugins:hibernate5:${gormVersion - '.RELEASE'}"
classpath "org.grails.plugins:views-gradle:2.1.0.M1"
classpath "gradle.plugin.com.energizedwork.webdriver-binaries:webdriver-binaries-gradle-plugin:$webdriverBinariesVersion"
}
}
plugins {
id "com.moowork.node" version "1.1.1"
id "com.github.ben-manes.versions" version "0.33.0"
}
version "0.1"
group "test_project"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"org.grails.plugins.views-json"
apply plugin:"asset-pipeline"
apply plugin:"io.spring.dependency-management"
apply plugin:"com.energizedwork.webdriver-binaries"
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
dependencies {
developmentOnly("org.springframework.boot:spring-boot-devtools")
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.grails:grails-dependencies"
implementation "org.grails:grails-web-boot"
implementation "org.grails:grails-core"
implementation "org.grails:grails-datastore-rest-client:6.1.12.RELEASE"
implementation "org.grails:grails-logging"
implementation "org.grails.plugins:cache"
implementation "org.grails.plugins:scaffolding"
implementation "org.grails.plugins:hibernate5:${gormVersion - '.RELEASE'}"
implementation "org.hibernate:hibernate-ehcache"
console "org.grails:grails-console"
profile "org.grails.profiles:web"
runtime("org.springframework.boot:spring-boot-properties-migrator")
runtime "com.bertramlabs.plugins:asset-pipeline-grails:3.2.5"
runtime "com.h2database:h2"
testImplementation "org.grails:grails-gorm-testing-support:$testingVersion"
testImplementation "org.grails:grails-web-testing-support:$testingVersion"
testImplementation "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testRuntime "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion"
testImplementation "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-api:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
implementation "com.github.jsimone:webapp-runner:9.0.27.1"
implementation "org.grails.plugins:spring-security-core:4.0.2"
implementation "org.grails.plugins:spring-security-rest:3.0.1"
implementation "org.grails.plugins:postgresql-extensions:5.3.0"
implementation "org.grails.plugins:views-json:2.1.0.M1"
implementation "org.grails.plugins:mail:3.0.0"
implementation 'io.github.http-builder-ng:http-builder-ng-core:1.0.3'
runtime "org.postgresql:postgresql:42.2.11"
// Para tirar os warnings do application.yml
implementation "org.springframework.boot:spring-boot-configuration-processor"
}
webdriverBinaries {
chromedriver "$chromeDriverVersion"
geckodriver "$geckodriverVersion"
}
tasks.withType(Test) {
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')
}
springBoot {
mainClassName = 'test_project.Application'
}
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
sourceResources sourceSets.main
}
assets {
minifyJs = true
minifyCss = true
includes = ["fonts/*"]
}
processResources.dependsOn(['npmInstall', 'npm_run_bundle'])
assetCompile.dependsOn(['npmInstall', 'npm_run_bundle'])
task stage() {
dependsOn clean, war
}
tasks.stage.doLast() {
delete fileTree(dir: "build/distributions")
delete fileTree(dir: "build/assetCompile")
delete fileTree(dir: "build/distributions")
delete fileTree(dir: "build/libs", exclude: "*.war")
}
war.mustRunAfter clean
task copyToLib(type: Copy) {
into "$buildDir/server"
from(configurations.compile) {
include "webapp-runner*"
}
}
stage.dependsOn(copyToLib)
Here is gradle.properties:
grailsVersion=4.1.0.M2
groovyVersion=3.0.6
gormVersion=7.1.0.M2
gradleWrapperVersion=6.6.1
testingVersion=2.2.0.M2
gebVersion=3.4
seleniumVersion=3.12.0
webdriverBinariesVersion=1.4
chromeDriverVersion=86.0.4240.22
geckodriverVersion=0.23.0
seleniumSafariDriverVersion=3.14.0
How can I make Spock (that is a transitive dependency from Geb) to use the Groovy 3 (that is already in my classpath)?
Thanks in advance.
A quick check shows that the current master of Geb still depends on spock-1.3-groovy-2.5, so I am not sure if you can use Geb with Spock 2.0. But it looks as if you cannot, see Geb issue #619. Consequently, you want to stick with Spock 1.3 and Groovy 2.5 for now.
With Grails 4.1.0.M2, grails create-functional-test acceptance.tests.Logout worked as a charm. But I did some extra steps (to avoid bleeding edge, as #kriegaex says in comments).
What I did was:
Updated to Grails 4.1.0.M2
Rolled back to Gradle 5.1.1 (recommended version)
Recreated gradle wrapper (gradle wrapper --gradle-version 5.1.1)
Continued with Groovy 3.0.6 (3.0.3 gave a dependency incompatibility)
Everything else came from Maven BOM associated with Grails 4.1.0.M2 (as saw in my build.gradle in my question )
But the gotcha is that Grails 4.1.0.M2 comes with Spock 2.0-M2-groovy-3.0, that solves the problem pointed out in #kriegaex answer.
Also, thanks for #JeffScottBrow for the tips in the comments.

Grails with Vaadin 8 - 'Failed to load the widgetset"

I am a newbie in the areas in Grails and Vaadin 8, and I’m having a bit of trouble trying to add widgets to my Vaadin/Grails application.
To begin, I created a grails/Vaadin app using the me.przepiora.vaadin-grails:web-vaadin8:0.3 profile. I edited the build.gradel file, as advised and
ran the command ”gradle wrapper --gradle-version 4.0” (again, as advised by the profile setup).
Here is my build.gradle after applying the edit:
apply plugin:"com.devsoap.plugin.vaadin"
buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://dl.bintray.com/macprzepiora/gradle-plugins/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
classpath "com.devsoap.plugin:gradle-vaadin-plugin:1.2.0.beta1-macprzepiora2"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.8"
}
}
version "0.1"
group "foobar"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"asset-pipeline"
apply plugin:"org.grails.grails-gsp"
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
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-web-boot"
compile "org.grails:grails-logging"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-plugin-i18n"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:scaffolding"
compile "com.vaadin:vaadin-spring-boot-starter:2.+"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.5.Final"
compile "org.grails.plugins:gsp"
console "org.grails:grails-console"
profile "me.przepiora.vaadin-grails:web-vaadin8:0.3"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
runtime "com.h2database:h2"
runtime "org.apache.tomcat:tomcat-jdbc"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.8"
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-web-testing-support"
}
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
addResources = true
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
plugins {
id 'com.devsoap.plugin.vaadin' version '1.3.1'
}
assets {
minifyJs = true
minifyCss = true
}
The resulting grails/Vaadin app worked fine, displaying a button which , when pressed, displayed an error message.
I then tried to enhance the app slightly, by replacing the button with a Vaadin Tree, backup by a TreeData instance.
Unfortunately, when I did this, I got the error message:
“Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.ui.Tree Check its component connector's #Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.”
After a google search I found something that appeared to be related at:
How do I fix 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.addon.charts.Chart
Based on this, I added the line #Widgetset("AppWidgetset") to my GrailsUI class (the only class in my project that inherits from com.vaadin.ui.UI).
After doing this, I get a new runtime error:
“Failed to load the widgetset: ./VAADIN/widgetsets/AppWidgetset/AppWidgetset.nocache.js?1525623851485”
I feel so frustrated - it feels like i’m really close to a working application, if only I knew the magi incantation :-(

Grails 3.x update - bootRun failed

I have upgraded small application from Grails 2.2 to Grails 3.2.3. After resolving compilation issues everything looks OK, but bootRun is failing and there is no obvious clue why.
My build.gradle:
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "http://repository.jboss.com/maven2/" }
maven { url "http://repo1.maven.org/maven2/" }
maven { url "http://repo.spring.io/milestone/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.11.6"
classpath "org.grails.plugins:hibernate5:6.0.4"
}
}
version "0.1"
group "testmonitor"
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"
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "http://repository.jboss.com/maven2/" }
maven { url "http://repo1.maven.org/maven2/" }
maven { url "http://repo.spring.io/milestone/" }
}
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:hibernate5"
compile "org.hibernate:hibernate-core:5.1.2.Final"
compile "org.hibernate:hibernate-ehcache:5.1.2.Final"
compile 'org.grails.plugins:spring-security-core:3.1.1'
compile "org.grails.plugins:quartz:2.0.1"
compile 'org.grails:grails-datastore-rest-client'
profile "org.grails.profiles:web"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.11.6"
runtime "com.h2database:h2"
compile 'org.apache.commons:commons-math3:3.6.1'
compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
compile 'net.sf.opencsv:opencsv:2.3'
console "org.grails:grails-console"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.11.6"
runtime 'mysql:mysql-connector-java:5.1.29'
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"
}
bootRun {
jvmArgs = ['-Dspring.output.ansi.enabled=always']
}
assets {
minifyJs = true
minifyCss = true
}
A log with gradle --debug (cant see any issue here) can be downloaded from Sharepoint.
I use IntelliJ IDEA 2016.3, when I run grails run-app I am getting the same result. I can not find any option to log/info grails command.
[running grails run-app][1]
UPDATE: now grails run-app seems OK, but htpp 404 is returned.
you need to clear the old gradle cache too. follow the below link. I was getting almost same errors.
https://stackoverflow.com/a/39462689/3711185

Spring security core framework getting configured twice in Grails Spring security core plugin

I am using Grails spring security core plugin version 3.0.3.
The debug statements when configuring the spring security core framework are printed twice and the filter chain is also initialized twice
WARN grails.plugin.springsecurity.SpringSecurityCoreGrailsPlugin -
Configuring Spring Security Core ...
Configuring Spring Security Core ...
WARN grails.plugin.springsecurity.SpringSecurityCoreGrailsPlugin - ... finished
configuring Spring Security Core
... finished configuring Spring Security Core
Build gradle file
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate:4.3.10.5"
}
}
plugins {
id "io.spring.dependency-management" version "0.5.2.RELEASE"
}
version "0.1"
group "restservicesapp"
apply plugin: "spring-boot"
apply plugin: "war"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
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-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
provided "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"
runtime "mysql:mysql-connector-java:5.1.38"
compile 'org.grails.plugins:spring-security-core:3.0.3'
compile ('org.grails.plugins:spring-security-rest-gorm:2.0.0.M2') {
exclude group: 'org.grails.plugins', module: 'spring-security-core'
}
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
//console "org.grails:grails-console"
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
Do you have org.grails.plugins:cxf into your build.gradle ? Possibly two context are being created. One for your main app and other for your /services/*. Move the cfx dependency in gradle file above spring security plugin and then you should see spring security being configured once only. I have been struggled with this more then 2 weeks now. But this solved this issue for me. For me it actually was an issue as the spring security being configured second time it was giving my NPE at times. See this question from myself only.
Update
My above assessment proved wrong. The real solution is, add below snippet to your build.gradle
configurations.runtime {
exclude module: "cxf"
}
I believe Spring Security is not being configured twice. One line of output is from logging, the other is a println.
Below is some code from grails.plugin.springsecurity.SpringSecurityCoreGrailsPlugin:
Closure doWithSpring() {{ ->
ReflectionUtils.application = SpringSecurityUtils.application = grailsApplication
SpringSecurityUtils.resetSecurityConfig()
def conf = SpringSecurityUtils.securityConfig
boolean printStatusMessages = (conf.printStatusMessages instanceof Boolean) ? conf.printStatusMessages : true
if (!conf || !conf.active) {
if (printStatusMessages) {
String message = '\n\nSpring Security is disabled, not loading\n\n'
log.warn message
println message
}
return
}
log.trace 'doWithSpring'
if (printStatusMessages) {
String message = '\nConfiguring Spring Security Core ...'
log.warn message
println message
}

how to get GWT work with Grails 3

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

Resources