Could not find method pluginManagement() for arguments - java

I am facing following issue while building spring boot project with gradle
What went wrong:
A problem occurred evaluating settings 'ConfigurationManager'.
Could not find method pluginManagement() for arguments [settings_4czoxeapfgxghi54ogzhrlgs9$_run_closure1#6e5e4ee] on settings 'ConfigurationManager' of type org.gradle.initialization.DefaultSettings.
Content of settings.gradle is as follows
pluginManagement {
repositories {
gradlePluginPortal()
}
}
rootProject.name = 'ConfigurationManager'
Content of gradle-wrapper.properties is as follows
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Content of build.gradle is as follows
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
id 'war'
}
apply plugin: 'io.spring.dependency-management'
group = 'demo.comp.dept'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-ldap'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
}

Related

GKE gradle no main manifest attribute

Hello i am testing GKE features and i created gradle java 17 init application, while deployment i have issue with manifest so i generated manually to artifact to resources :
Manifest-Version: 1.0
Main-Class: pl.kathelan.mdbackend.MdBackendApplication
here is my gradle build :
plugins {
id 'org.springframework.boot' version '2.7.3'
id 'io.spring.dependency-management' version '1.0.13.RELEASE'
id 'java'
}
group = 'pl.kathelan'
version = '0.0.1'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
jar {
manifest {
attributes(
"Class-Path": configurations.runtimeClasspath .collect { it.getName() }.join(' '))
}
}
sourceSets.main.resources.srcDirs = [ "src/" ]
i have tried this solution Gradle - no main manifest attribute , but for me was exception class no found. Looking for any help thanks.
found mistake in docker file :
ENV ARTIFACT_NAME=md-backend-0.0.1.jar
was md-backend-0.0.1-plain.jar

How to configure nested multi module gradle project

I'm trying to set up a nested multi module project with gradle.
I have the following structure:
stock-client-root
|-- settings.gradle
|-- build.gradle
|-- stock-client
| |-- build.gradle
|-- stock-ui
|-- build.gradle
The problem is, that I cannot import any dependencies that are declared in the build.gradle files except spring boot related things.
Example: I want to use javafx. I declared it in the stock-ui/build.gradle file but when I want to import it in the module, intelliJ tells me, it cannot resolve that dependency.
I tried almost everything to solve this:
Reload the project via gradle
Restart the IDE
Invalidate cache + rebuild project
Created a new project with that structure and tried it again
Can anyone point out, where the problem might be?
And here is the content of the files:
stock-client-root/settings.gradle
rootProject.name = 'stock-client-root'
include 'stock-client'
include 'stock-ui'
stock-client-root/build.gradle
subprojects {
apply plugin: 'java'
group = 'com.demo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
}
stock-client/build.gradle
plugins {
id 'org.springframework.boot' version '2.4.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.demo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
test {
useJUnitPlatform()
}
stock-ui/build.gradle
plugins {
id 'org.springframework.boot' version '2.4.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.demo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation group: 'org.openjfx', name: 'javafx-graphics', version: '13.0.1'
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}

Gradle dependency for springdoc-openapi-ui

I am trying to use springdoc-openapi-ui using gradle dependency.
Maven
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.4.3</version>
</dependency>
Gradle
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'fete.bird'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '14'
compileJava {
options.compilerArgs += ["--enable-preview"]
}
repositories {
jcenter()
mavenCentral()
}
ext {
set('springCloudVersion', "Hoxton.SR6")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
implementation 'org.springdoc:springdoc-openapi-ui'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'org.projectlombok:lombok'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
useJUnitPlatform()
}
Error
Could not find org.springdoc:springdoc-openapi-ui:.
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
What is the repository for the gradle?
Try adding the library with latest version in your project
implementation("org.springdoc:springdoc-openapi-ui:1.4.6")
implementation 'org.springdoc:springdoc-openapi-ui' fail with following error Could not find org.springdoc:springdoc-openapi-ui
While following worked
implementation 'org.springdoc:springdoc-openapi-ui:1.6.6'

Task 'generateApolloSources' not found in root project

I am using apollo graphql client in java code. My gradle file is
plugins {
id 'org.springframework.boot' version '2.2.6.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven {
url 'http://dl.bintray.com/apollographql/android'
}
}
dependencies {
implementation "com.apollographql.apollo:apollo-android-support:1.0.0"
implementation "com.apollographql.apollo:apollo-runtime:1.0.0"
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
I have followed the docs mentioned in https://github.com/apollographql/apollo-android
I got stuck at step 4 and 5.
Not able to add
generateKotlinModels.set(false)
}
in gradle file and while executing the command
gradlew generateApollo its getting error as
Task 'generateApolloSources' not found in root project 'testProject'
Could anyone please help
You will need to apply the Apollo plugin:
plugins {
id 'org.springframework.boot' version '2.2.6.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'com.apollographql.apollo' version '2.1.0'
}
You should also bump the Apollo dependencies to '2.1.0' as '1.0.0' is pretty old.

Gradle couldn't locate the Spring core jar

i am spring boot using gradle build. till yesterday gradle build was run smoothly. But today i got this following error ;
Could not resolve all artifacts for configuration ':classpath'.
Could not find spring-core.jar (org.springframework:spring-core:5.2.0.BUILD-SNAPSHOT:20190328.215418-203).
Searched in the following locations:
https://repo.spring.io/snapshot/org/springframework/spring-core/5.2.0.BUILD-SNAPSHOT/spring-core-5.2.0.BUILD-20190327.205120-195.jar
Could not find spring-jcl.jar (org.springframework:spring-jcl:5.2.0.BUILD-SNAPSHOT:20190328.215418-203).
Searched in the following locations:
https://repo.spring.io/snapshot/org/springframework/spring-jcl/5.2.0.BUILD-SNAPSHOT/spring-jcl-5.2.0.BUILD-20190327.205120-195.jar
this is my build.gradle file
buildscript {
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
maven {url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.3.RELEASE")
}
}
plugins {
id 'org.springframework.boot' version '2.2.0.BUILD-SNAPSHOT'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'
group = 'me.namila'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
jcenter()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
When visiting the relevant url,what i can see is gradle is searching for 27th march build (spring-jcl-5.2.0.BUILD-20190327.205120-195.jar) while the server has the 28th build spring-jcl-5.2.0.BUILD-20190328.164750-201.jar. how to fix this error? i have added buildscript repositories too. any suggesions?
As Antoniossss said in the comments, this happened because snapshot build failure. To fix it i moved to previous build version of springboot. i did the following changes to the build.gradle file;
id 'org.springframework.boot' version '2.1.3.RELEASE'
changed the '2.2.0.BUILD-SNAPSHOT' to 2.1.3 release. this fixed the error. :)
the buildscript repositories & dependencies are a mess, there's a mismatch:
buildscript {
repositories {
maven { url 'https://repo.spring.io/libs-milestone' }
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.2.0.BUILD-SNAPSHOT'
}
}
apply plugin: 'org.springframework.boot'
see the documentation.

Categories

Resources