Grails quick start problem: import cannot be resolved (Eclipse)

In my new new Grails project, I installed siro ( grails install-plugin shiro ) and quickly set up grails shiro-quick-start . This created new files as described in siro documentatio n.

However, in one of these controllers/(default package)AuthController.groovy there are eight problems noted by eclipse (SpringSource Tools Suite). Five of these problems relate to the five importers, respectively:

  Groovy:unable to resolve class org.apache.shiro.authc.AuthenticationException 

Specifying the correct package and moving the file to this package does not solve the problem. Three other markers of the problem:

  Groovy:Catch statement parameter type is not a subclass of Throwable. 

(x3) I believe that this problem may be due to failed import and may disappear after the previous problem has been fixed.

Now I could configure myself without a quick start, but tbh Id prefers to stick with a quick start and expand it as described in the manual.

(obviously) Question 1 : Does anyone have an idea why Eclipse is giving me these error messages? Did I skip a step in the installation process?

(not so important) Question 2 : I tried to apply the fix to the (default) problem, only to find that there is already a link to the package path in the corresponding part of _ShiroInternal.groovy. Why is it still installed in the default directory? Could this be due to my problem?

An additional oddity: there is another realm/ShiroDbRealm.groovy file that includes importing org.apache.shiro resources. There is no package declaration, and there are no error markers in Eclipse. Once I add the correct package declaration for my project and move the file to this package, import can no longer be allowed. This may be the key to what is happening here.

+4
source share
3 answers

You need to add the shiro library jars to the build path of the eclipse project. Libraries (in my case) are installed by default in the grails project plugin directory in my home folder.

+2
source

Perhaps an even easier fix that solved the problem when I worked on it:

No matter you already installed it in other ways, run:

grails install-plugin shiro

Although this may tell you that the plugin is already installed, it will also determine the path for you, which should fix the problem.

+2
source

I found that I made sure that you did the following

Paste compile ":shiro:1.2.1" into BuildConfig.groovy

Run the grails compile

right click in project> grails tools> update dependencies

0
source

All Articles