Unable to resolve Class for burningimage plugin in grails app - grails

I'm running grails 2.0.4 on a mac, and installed the burningimage plugin to handle image uploads.
I have this at in my domain object:
import pl.burningice.plugins.image.ast.FileImageContainer
however, netbeans says it's unable to resolve the class, and when I call imageUploadService in my controller, I get this error
No such property: imageUploadService for class: wine.WineController
Netbeans believes the plugin is installed, and I can see the plugin source files under the project in the .grails folder. Any idea how to resolve the import?

A grails clean and recompile might help it see the class. However I get these type of import 'errors' in Netbeans but everything compiles and runs fine.
Try injecting the service in your controller:
class WineController {
def imageUploadService
...
}

Related

How to Import existing Grails app into Intellij

I'm having a hard time importing an existing Grails 3 application into Intellij, in what feels like the "right way". I have the looked through the official intellij documentation but haven't found much to help me (what I have found hasn't fixed any of my issues). It's possible that I simply didn't find what I needed. This post here doesn't quite help me out either.
Here's what I've tried:
Note: The application I'm importing is grails 3.1.9 and works fine using the Grails CLI.
Import the project on build.gradle
I get the following errors/warnings:
Warning:<i><b>root project 'app': Unable to build Grails project configuration</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileCopy'.
Caused by: java.lang.RuntimeException: A conflict was found between the following modules:
- jline:jline:2.12
- jline:jline:2.11</i>
Warning:<i><b>root project 'app': Unable to build Grails project configuration</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileCopy'.
Caused by: java.lang.RuntimeException: A conflict was found between the following modules:
- jline:jline:2.12
- jline:jline:2.11</i>
However if I ignore those warnings, I can get the application to run by using a gradle run/debug configuration, using bootRun. If I try to setup a run/debug with Grails, intellij doesn't let me pick an "application". Adding Grails as a framework does not change this behavior. I'm also missing some of the grails specific features that Intellij gives you.
Create the project from existing sources
Following this series of menu's, I have no idea what to pick. With the defaults that Intellij selects, I am still unable to set a Grails run/debug configuration. I assume I just have to select the right sources, but I have no idea what I should be selecting.
If someone could give me a list of steps to perform, or point out exactly where I need to go in the documentation, that would be very helpful and appreciated.

Grails 3.2.0 Bootstrap.groovy script doesn't execute

After i updated my project from Grails 3.1.11 to 3.2.0 the project has stopped working.
When i start proj from IDE, it works fine. But when i pack it to jar and try to run in terminal, BootStrap.groovy does not execute.
What is the problem?
I just found an issue on GitHub. Now BootStrap.groovy and UrlMappings.groovy should be in the default package
Default package is indicated in application.yml
grails:
codegen:
defaultPackage: com.example.app
Migration docs has no information about this issue yet..
sergey Linnik's answer is correct the Bootstrap.groovy file should be in a default package, but lookout when using a IDE (in my case Intellij 2016.2.4) for refactoring the Bootstrap.groovy class from the init folder to a default package that it adds
package default //ensure the package folder is added
class BootStrap {///}
Otherwise when building the grails application it moves the Bootstrap.groovy file out of the default package again because the refactoring didn't update it. Not sure if it's an intellij bug or not..

Grails 3.0 and Spring Security

I'm using Grails 3.0.1 with IntelliJ Idea and I'm trying to use Spring Security plugin on my project.
I know that old spring-seurity-core plugin is not compatible with Grails 3.0 version. Thus I've tried to follow this tutorial: http://spiesdavid.blogspot.fi/2015/03/grails-3-app-with-security-part-1.html
I've added the compile line in build.gradle file in dependencies. I've also added the logger line in logback.groovy file.
Problems start after that. There is no such file as SecurityConfiguration.groovy and there is no org.springframework.security package so I can't import them and it gives an error. So I can't create the file either.
So I am assuming that your question is: «How do I get this to work?»
spring security plugin 3.0.0 (for grails 3.x) was released just a few days ago. Documentation is quite good. Start here: https://grails-plugins.github.io/grails-spring-security-core/
There are some problems with Intellij. I tried to add spring security to a slightly older grails project (started with intellij 15.0.1 and grails 3.0.9). Adding the dependencies was successful and rebuilding it made the plugin available, also in the grails console. But when I launched a debug instance of the application directly from the IDE, it would not show spring security among the loaded/installed plugins. I made a pristine project with IntelliJ 15.02, grails 3.0.10 and just copied my code over to the new project. Now it works.
Note there are some issue with IntelliJ not major. do the following it will work:
on your build.gradle add compile 'org.grails.plugins:spring-security-core:3.0.0.M2'
run command compile
run comand s2-quickstart yourAppName User Role
now you should see "application.groovy" file under conf folder
as usual use #Secured annotation in your controller

Getting Error WAR packaging error: startup failed for grails war

I am working on grails application and using grails 2.3.3 version. When I run grails app-run, it works fine, but for grails war, it throws Error WAR packaging error: startup failed with details following:
/home/vieenay/.grails/2.3.3/projects/VProcureFinal/gspcompile/gsp_VProcureFinal_layoutsspringSecurityUI_gsp.groovy: 2: unable to resolve class org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
# line 2, column 1.
import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
^
/home/vieenay/.grails/2.3.3/projects/VProcureFinal/gspcompile/gsp_VProcureFinal_layoutsspringSecurityUI_gsp.groovy: 3: unable to resolve class grails.plugins.springsecurity.SecurityConfigType
# line 3, column 1.
import grails.plugins.springsecurity.SecurityConfigType
^
Note: I have added following plugins to buildconfig.groovy file to deploy on heroku.
compile(':heroku:1.0.1') {
exclude 'database-session'
}
compile ':cloud-support:1.0.8'
Basically I am trying to deploy my grails app to Heroku. I can run my application locally successfully but even grails war does not work and throwing above error. I tried to search grails mailing list and stackoverflow but could not get solution.
Any idea why this is happening.Please let me know you need more code to be pasted.
If you're seeing "grails.plugins.springsecurity" anywhere when using the 2.0 plugin, something's wrong. From the error, it looks like you're still using the old version of the spring-security-ui plugin - make sure you're using 1.0-RC1 of the UI plugin, and that any of the other spring-security-core secondary plugins (e.g. LDAP, ACL, etc.) are also the newer versions that are compatible with the 2.0 core plugin.

Grails: server crashes when I recompile a file (when using datasources)

I'm using datasources in my Grails project.
When I edit a groovy file with server running I get the following error:
Running Grails application.. java.lang.IllegalArgumentException: Must
supply a resource type for JNDI configuration
How can I configure grails.naming.entries in Config.groovy to fix this?
Note: I'm using grails 1.3.6
Tks
I'm using 1.3.7 and hit the same issue. There's a couple bugs in the JIRA about this, looks like they were finally fixed in 2.0-M1. There's a patch for 1.3.1+ versions here, but I haven't tested that yet.
Link to possible patch: http://jira.grails.org/browse/GRAILS-7021

Resources