spring clound eureka server dependencies error gradle intellij - java

Am not able to add the spring-cloud-netflix-eureka-server as dependencies in gradle project (IDE Intellij)
please find my build.gradle file below.
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'war'
}
group = 'com.lti.mod.services'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation('io.jsonwebtoken:jjwt:0.9.1')
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.liquibase:liquibase-core'
/*compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'*/
compile('org.springframework.cloud:spring-cloud-netflix-eureka-server:2.1.5.RELEASE')
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.security:spring-security-test'
}
test {
useJUnitPlatform()
}
Please find the gradle build messages below.
> Configure project : The compile configuration has been deprecated for dependency declaration. This will fail with an error in Gradle 7.0. Please use the implementation configuration instead. Consult the upgrading guide for further information: https://docs.gradle.org/6.4.1/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations
at build_5fewyf5k4gqf0wzmewce4q3ow$_run_closure3.doCall(D:\AngularCourse\core-services\build.gradle:30)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)

compile configuration is deprecated in the Gradle 7.0 as your error message says. Please use implementation instead.
Check the docs - https://docs.gradle.org/current/userguide/java_plugin.html#tab:configurations

Related

Spring boot kafka application is not start as console app after upgrading gradle and spring boot version

upgradation details.
Spring boot : 2.2.7-RELEASE to 2.4.6
gradle: 4.10.3 to 6.9.2
build.gradle
plugins{
id 'org.springframework.boot' version '2.4.6'
id 'io.spring.dependency-management' version '1.0.11.RELESE'
id 'java'
}
sourceCompatibility ='1.8'
dependency-management{
import {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2020.0.4"
}
}
dependencies{
implmentation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implmentation 'org.springframework.boot:spring-boot-starter-web'
implmentation 'org.springframework.kafka:spring-kafka'
implmentation 'org.projectlombok.lombok'
testImplmentation 'org.springframework.boot:spring-boot-starter-test'
implmentation 'org.springframework.cloud:spring-cloud-starter-config'
implmentation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
compile 'org.springframework.boot:spring-boot-starter-webflux'
implmentation 'org.springframework.boot:spring-boot-starter-data-jpa'
compile(group: 'org.springframework.boot', name: 'spring-boot-configuaration-processor')
compile(group: 'com.microsoft.sqlserver', name: 'mssql-jdbc' version: '8.3.1.jre8-preview')
runtimeOnly 'com.microsoft.sqlserver:mysql-jdbc'
implmentation 'io.springfox:springfox-swagger2:2.9.2'
implmentation 'io.springfox:springfox-swagger-ui:2.9.2'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.projectreactor:reactor-spring'
implmentation 'io.micrometer:micrometer-registry-prometheus'
implmentation 'javax.mail:mail:1.4'
testImplmentation 'junit:junit'
annotationProcessor 'org.projectlombok:lombok'
}
wrapper{
distribuationUrl = "https://services.gradle.org/distributions/gradle-6.9.2-bin"
}
main class:
#SpringBootApplication(exclude={DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
#EnableKafka
#EnableScheduling
public class SpringBootMainClassApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootMainClassApplication.class, args);
}
}
application.properties
server.port=8080
Error:
“ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean“.
enter image description here
Code running fine after adding below properties to application.properties.
spring.main.web-application-type=none
Application is working fine as console app without changing spring.main.web-application-type=none to properties with old version spring boot 2.2.7-RELEASE, Can you please help us to run application without adding new properties?
It is working fine, seems you gradle has lot of errors
Please use this gradle, always love your code as beautiful it could be like a painting :)
plugins {
id "io.spring.dependency-management" version "1.0.11.RELEASE"
id "org.springframework.boot" version "2.4.6"
id "java"
}
sourceCompatibility ='1.8'
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2020.0.4"
}
}
dependencies
{
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jdbc'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.kafka', name: 'spring-kafka'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'javax.mail:mail:1.4'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
compileOnly group: 'org.springframework.boot', name: 'spring-boot-configuaration-processor'
compileOnly group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '8.3.1.jre8-preview'
compileOnly 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.springframework.boot:spring-boot-starter-actuator'
compileOnly 'org.projectreactor:reactor-spring'
runtimeOnly 'com.microsoft.sqlserver:mysql-jdbc'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'junit:junit'
annotationProcessor 'org.projectlombok:lombok'
}

Setting up Spring Native Experimental (id 'org.springframework.experimental.aot' version '0.10.3' was not found in any of the following sources)

Hello ladies and gentlemen,
so i was just trying to get a executable for my Spring application by using Spring Native.
My build.gradle:
plugins {
id 'org.springframework.boot' version '2.5.4'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'org.springframework.experimental.aot' version '0.10.3'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.4'
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.4'
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.4'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.14'
implementation group: 'org.apache.poi', name: 'poi', version: '4.1.2'
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.2'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.14.6'
implementation group: 'org.json', name: 'json', version: '20180813'
}
test {
useJUnitPlatform()
}
and my settings.gradle:
rootProject.name = 'demo'
after adding the 'org.springframework.experimental.aot' version '0.10.3' plugin to the build.gradle as seen above (doing whats told in the documentary under 2.1.2 https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#getting-started), i get following error:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.springframework.experimental.aot', version: '0.10.3'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.experimental.aot:org.springframework.experimental.aot.gradle.plugin:0.10.3')
Searched in the following repositories:
Gradle Central Plugin Repository
The person who commented is right, though I think unnecessarily rude given that the tutorial is out of order, and they tell you to apply the plugin prior to giving you instructions how to install.
More specifically, you need to add the spring release maven repo to your settings.gradle.kts in order to source the plugin
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = uri("https://repo.spring.io/release") }
mavenLocal()
}
}
and then also add the repository to your build.gradle.kts in order to source the dependencies
repositories {
maven { url = uri("https://repo.spring.io/release") }
}

Gradle execution failed for task ':compileTestJava'

I have encountered an error when running my Gradle program in Intellij-IDEA. I'm unsure why it gave me an error. I believe one of the dependencies might be deprecated if that's the case. Please enlighten me on this. Thanks. I have posted the Error StackTrace and Build.Gradle files below.
Error StackTrace
Execution failed for task ':compileTestJava'.
> Could not resolve all files for configuration ':testCompileClasspath'.
> Could not find android.arch.persistence.room:runtime:1.1.1.
Required by:
project :
Build.Gradle
plugins {
id 'org.springframework.boot' version '2.3.4.RELEASE'
}
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group 'AbtMainTestControl'
version '1.0-SNAPSHOT'
// Versioning of dependencies
wrapper.gradleVersion = '5.5.1'
def cucumberVersion = '4.7.1'
def junitVersion = '5.5.0'
def restVersion = '4.1.2'
def apacheDrillVersion = '1.17.0'
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation 'android.arch.persistence.room:runtime:1.1.1'
compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.13'
compile group: 'com.opencsv', name: 'opencsv', version: '4.0'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.12'
// https://mvnrepository.com/artifact/org.apache.drill.tools/tools-parent
compile group: 'org.apache.drill.tools', name: 'tools-parent', version: "${apacheDrillVersion}", ext: 'pom'
// Cucumber Pretty Report Plugin
compile group: 'de.monochromata.cucumber', name: 'reporting-plugin', version: '3.0.9'
testCompile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.1.0.jre8'
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.7.0'
// Importing ModelMapper Library for DTO
compile 'org.modelmapper:modelmapper:2.3.3'
// Importing Spring Boot Dependency
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
testImplementation "io.cucumber:cucumber-java:${cucumberVersion}"
testImplementation "io.cucumber:cucumber-junit:${cucumberVersion}"
testImplementation "io.rest-assured:rest-assured:${restVersion}"
testImplementation "io.rest-assured:json-path:${restVersion}"
testImplementation "io.rest-assured:json-schema-validator:${restVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junitVersion}"
implementation 'junit:junit:4.12'
//Lombok plugin for DTO
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
//MapStruct Mapper Framework for serialising DTO
implementation 'org.mapstruct:mapstruct:1.4.0.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.0.Final'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin',
'pretty',
'--glue',
'gradle.cucumber',
'src/test/resources/features',
]
}
}
}
test {
//useJUnitPlatform()
systemProperty "cucumber.options", System.properties.getProperty("cucumber.options")
}
Note: I have re-posted the Build.Gradle file.
The answer that I thought was that my program focuses on DTO which the dependency that I had an issue with has got nothing to do with my program.
implementation 'android.arch.persistence.room:runtime:1.1.1'
In fact, the dependency includes android as the root word for the dependency which is more catered towards Android which doesn't make any sense with my DTO Program.
So what I did was to remove implementation 'android.arch.persistence.room:runtime:1.1.1' together with annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'. Eventually, the program works fine as I'm already using the MapStruct Annotation Processor to do mapping with DTO.

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.

Categories

Resources