Grails 4 Spring Security Plugin - gradle

After upgrading from Grails 3.3.9 to 4 there are several packages missing. E.g. unable to resolve class org.springframework.security.provisioning.JdbcUserDetailsManager. Has anyone any ideas? I've done all the steps from here: https://docs.grails.org/4.0.0.M1/guide/upgrading.html.
It seems that Gradle 5 can not load all the dependencies in the plugin. With Grails 3.3.9 and Gradle Wrapper 3.5 everything worked fine.
Thanks for any advices.

Related

Grails - IntelliJ can't resolve symbols and objects

ItelliJ can't resolve grails symbols. For example symbol 'group' in UrlMapping.groovy.
It's happening in every project with grails 3 or greater (in grails 2.4.4 everything works fine).
I did try to import project, open project, create new project in IntelliJ, create project in 'grails' interactive mode etc.
My suspicion is that either I'm doing something wrong with opening/creating Gradle project or maybe there is something wrong with my settings in IntelliJ.
This is example of that behaviour:
I'm using following versions:
IntelliJ IDEA:
Grails installed with sdkman - version 4.0.3
Java installed with sdkman - version 8.0.242.hs-adpt
How can I set IntelliJ to work just fine with grails?
Any help would be appreciated, thanks in advance!

"unable to resolve class" error after upgrading gradle 3 to gradle 4

Grails version: 3.2.9
Gradle initial version: 3.4.1 (everything works fine with this version)
Gradle upgraded version:4.10.3
Plugin: org.grails.grails-gsp
When I run gradlew war after upgrading gradle version to 4.10.3 I start to get the following error during execution of compileGroovyPages task:
dashboard_gsp.groovy: 2: unable to resolve class com.abnd.CarStatusEnum
# line 2, column 1.
import com.abnd.CarStatusEnum
^
Location of class com.abnd.CarStatusEnum is src/main/groovy/com/abnd/CarStatusEnum in the same project where the build is being run and gradlew war task completes successfully with gradle version 3.4.1. However when I upgrade gradle version to 4.10.3 then I start to get this error. Same happens with gradle version 4.1.
1) Any clue what can be the problem ?
2) Is that a good idea to use gradle version 4.x.x or 5.x.x with grails version 3.x.x as with gradle 5.x.x I start to get even more issues as some grails plugins(like grails-gsp v3.3.2 which is latest stable version) use some features that have been deprecated in gradle 4.x.x and removed from gradle 5.x.x (see the error bellow)?
Failed to apply plugin [id 'org.grails.grails-gsp']
Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
1) Any clue what can be the problem ?
Yes. The error message is a clue that the GSP compiler can't find the enum class. This is because our plugin isn't compatible with Gradle 4.10.3.
2) Is that a good idea to use gradle version 4.x.x or 5.x.x with
grails version 3.x.x
No. Those Gradle versions are not supported with the version of Grails you are using.
I hope that helps.

MULE 3.8.1 Hibernate 4.3.11 - org.hibernate.jpa.boot.archive.spi.ArchiveException: Could not build ClassFile

I am developing an application for MULE ESB CommunityEdition (3.8.1 version).
I have included (provided by MULE) SPRING 4.1.6.RELEASE in project.
For persistence layer I set up Hibernate 4.3.11.FINAL.
My code is based on this idea (https://www.ricston.com/blog/jpa-mule/).
So basically i have included in the project (besides MULE dependencies):
hibernate-entitymanager (4.3.11.Final)
hibernate-core (4.3.11.Final)
hibernate-jpa-2.1-api (1.0.0.Final)
spring-orm (4.1.6.RELEASE)
And everything was working perfectly fine until i started to use Java 8 API...
Whatever I do: any lambda, stream or anything I am still getting error:
org.hibernate.jpa.boot.archive.spi.ArchiveException: Could not build ClassFile
What I did until now:
tried to add org.javassist dependency (in version from 3.18.0-GA to 3-22.0-GA) - nothing happened,
tried to exclude org.reflections.0.9.9 dependency (mule is including that in some its core dependencies): also nothing happened
I spent on this about 5 hours I am really close to give it up... I really need hibernate cause this project will include many db operations
What else Can i Try to do?
Problem solved!!
I was using mvn dependency:tree to check if there are any org.javassist dependencies in project.
And there weren't...
Then I checked the folder: {mule_home}/lib/opt and there was an old version of org.javassist library!
So: I downloaded latest org.javassist jar and I put it in the {mule_home}/lib/user folder.
Now it works like a charm :)
Please check if your Anypoint Studio is pointing correct JDK.
Check below
Preference> Installed JRE >> It should have JDK 1.8 checked.

Grails 2.2.1 app cannot resolve dependencies

I am running into problems setting up an existing grails (2.2.1) project on a new mbp. I get dependency resolution errors whenever I try to run any grails command. It seems that it cannot resolve any grails plugins that are marked with the compile phase like below.
compile ":cache:1.0.0"
I've taken a look at the org.grails.plugins repository to make sure the plugins exist, and they all appear to be there. I cannot for the life of me figure out why it cannot resolve these plugins. A coworker said he upgraded to grails 2.4, got the dependencies to resolve and download to his local cache, then went back to grails 2.2.1 to run the app. I'd rather figure this out than have to do that.
Anyone seen something like this before?
Recently I faced the same problem with Grails 2.2.0.
I've fixed it by adding this repository to BuildConfig.groovy:
mavenRepo 'https://repo.grails.org/grails/plugins'
http://grails.1312388.n4.nabble.com/Grails-central-repo-seemingly-missing-plugin-versions-td4658720.html

Mavenize Grails project not works in STS

I am using STS 3.6.1, Java 7, Grails 2.4.3.
When create a normal Grails project, it works good. However, my Grails project need to depends on other java projects, so I convert it to maven project. After that STS prompt error
Could not find the grails dependency file. This probably means that there is a bad dependency in the pom file.
java.lang.Exception
The maven grails project can be build in grails command.
How to resolve is issue? Or if there is walk around to let grails project depends on other Java project.

Resources