Grails Spring Social Plugin Build Error - spring

I get the following error when trying to compile my Grails App using Spring Social plugin:
| Error Fatal error during compilation org.apache.tools.ant.BuildException:
java.lang.NoClassDefFoundError: org/springframework/social/ApiBinding
This is what I have added to my BuildConfig.groovy plugins section:
compile ':spring-security-core:1.2.7.3'
compile ":spring-security-facebook:0.14.5"
compile ":spring-social-core:0.1.31"
compile ":spring-social-facebook:0.1.32"

I had the same problem, and think I've just solved it by switching to the "spring-security-facebook" and "spring-security-twitter" Grails plugins, which themselves just source current versions of the Spring Social plugins directly from SpringSource repos.
I'm using the following with Grails 2.3.0 without errors:
Custom repositories:
mavenRepo "http://repository.springsource.com/maven/bundles/release/"
mavenRepo "http://repository.springsource.com/maven/bundles/external/"
mavenRepo "http://maven.springframework.org/release/"
Plugins:
compile ":spring-security-core:1.2.7.3"
compile ":spring-security-facebook:0.15"
compile ":spring-security-twitter:0.5.4"
As far as I can tell the problem was simply that the Spring Social Core/Facebook/Twitter plugins for Grails are years out of date (last updated in 2011) and incompatible with recent versions of Spring Security and/or Grails.

Related

Gradle: Could not resolve all files for configuration ':compileClasspath'

Gradle build is throwing the following error
What went wrong:
Execution failed for task ':compileJava'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find com.oracle:ons:19.3.
Required by:
project :
project : > com.xyz.abc.utils:openshift-utils:2.0.30
I have added the below dependency
implementation('com.oracle:ons:19.3')
Also the below repository
mavenCentral()
maven { url 'http://repository.xyz.com:8081/artifactory/gradle-plugins'; allowInsecureProtocol true
metadataSources {
mavenPom()
artifact()
}
}
I can see this dependency under Project and External Dependencies
The project that is needing this dependency has the below line in build.gradle
compile("com.oracle:ons:19.3")
I'm using gradle wrapper and gradle version is 7.4.2
Can you please help in resolving this error?
I was also facing similar issue. This resolved for me when I used a compatible spring boot version for particular JAVA version you are using in your project.I was getting similar issue-
For example - version 3.0.0 is not compatible with JAVA 11
But when I used version 3.0.0 with JAVA 17 and rebuild the project, it was resolved

Is io.spring.dependency-management plugin required when using Spring Boot 2.3+ and Spring Cloud?

I'm using Gradle 6.6 to build my Spring Boot app. According to this post, the io.spring.dependency-management plugin is no longer needed since Gradle 5+ supports BOM files.
However, I receive the following error if I remove the plugin:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.6.1-bin.zip'.
Build file 'C:\my-app\build.gradle' line: 14
A problem occurred evaluating root project 'my-app'.
Could not find method dependencyManagement() for arguments [build_6e8ejdhnd2no2m9jw221sctmn3$_run_closure2#432e46e2] on root project 'my-app' of type org.gradle.api.Project.
Line 14 of my build.gradle file is referenced in the above error. Here are lines 14-18:
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR8"
}
}
Is there another way to specify the required dependencies for Spring Cloud without using io.spring.dependency-management plugin?
dependencyManagement() is provided exclusively by the io.spring.dependency-management plugin. Which means you cannot use it if you don't use the plugin.
And in that case you have to use the gradle's platform capability.
In the post you linked there's an example of that.
To fix your build, remove the dependencyManagement part and add
implementation platform("org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR8")
to your dependencies { }
Reference: https://docs.spring.io/dependency-management-plugin/docs/current/reference/html/#dependency-management-configuration-dsl

Spring boot gradle project with kotlin setup issue

Hello i want to create a Spring boot app with kotlin and Gradle but i have this issue in the plugins line, it doens't recognize any plugin i add ,i couldn't undrestand what's missing, i'm using Gradle 6.3v , jdk 8
Error:
Error
And that's the build.gradle file
build.gradle.kts
Your first plugin declaration has a typo in the version:
kotlin("jvm") version "1.3.11" needs to be kotlin("jvm") version "1.3.71"
I would start by changing that so all usages of kotlin plugins are aligned on a recent version.
If that does not resolve the problem, try running the build from the CLI with the added flag --stacktrace which may tell you more about why is the plugin not found.

Spring Integration Java DSL Error

I have set up a new Spring Boot + Spring Integration + Spring Integration Java DSL project using latest available versions. The project builds okay but, when I run the application, I am getting:
Caused by: java.lang.NoSuchMethodError: org.springframework.integration.dsl.StandardIntegrationFlow.isRegisterComponents()Z
at org.springframework.integration.dsl.config.IntegrationFlowBeanPostProcessor.processStandardIntegrationFlow(IntegrationFlowBeanPostProcessor.java:139) ~[spring-integration-java-dsl-1.2.3.RELEASE.jar:?]
at org.springframework.integration.dsl.config.IntegrationFlowBeanPostProcessor.postProcessBeforeInitialization(IntegrationFlowBeanPostProcessor.java:100) ~[spring-integration-java-dsl-1.2.3.RELEASE.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
The dependencies being used are currently as follows:
compile ("org.springframework.boot:spring-boot-starter:2.0.0.RC1") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
}
compile "org.springframework.boot:spring-boot-starter-data-jpa:2.0.0.RC1"
compile "org.springframework.boot:spring-boot-starter-log4j2:2.0.0.RC1"
compile "org.springframework.integration:spring-integration-core:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-http:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-jms:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-java-dsl:1.2.3.RELEASE"
Could the error be due to wrong combination of jar versions? I am not sure how to debug this error.
When you use Spring Integration 5.0 already, you don't need that extra spring-integration-java-dsl dependency. It has been merged to the core project since the version 5.0.
See more info in the Migration Guide and on that page for Spring Integration Java DSL project.

Get Derived ("Blessed") Version of Dependency from Spring Boot Gradle Plugin

I have a Spring Boot project which uses "blessed" dependencies via the Gradle plugin. The dependencies block in my build.gradle file looks like this:
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "com.fasterxml.jackson.core:jackson-core"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-csv"
}
(I've removed several other dependencies for brevity.)
The above code is broken because Spring Boot does not have a "blessed" version for the dataformat-csv extension.
All I want to do is get it to use the Spring Boot-derived version for jackson-core and use it for the jackson-dataformat-csv as well for consistency. How do I get the version number for that dependency if it's been derived by a plugin?

Resources