1

I have this dependencies in my gradle file.

dependencies {
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.cloud:spring-cloud-starter-sleuth')
implementation('org.springframework.cloud:spring-cloud-starter-zipkin')
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
implementation group: 'ch.qos.logback.contrib', name: 'logback-json-classic', version: '0.1.5'
implementation group: 'ch.qos.logback.contrib', name: 'logback-jackson', version: '0.1.5'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.24'
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
implementation group: 'com.oracle', name: 'ojdbc', version: '6.0'
compileOnly('org.projectlombok:lombok')
testImplementation('org.springframework.boot:spring-boot-starter-test')
integrationTestCompile('org.springframework.boot:spring-boot-starter-test')
integrationTestCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '2.1.6'
integrationTestCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
integrationTestCompile group: 'ch.qos.logback.contrib', name: 'logback-json-classic', version: '0.1.5'
integrationTestCompile group: 'ch.qos.logback.contrib', name: 'logback-jackson', version: '0.1.5'
integrationTestCompile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'}

However after adding:

implementation("org.springframework.boot:spring-boot-starter-data-jpa")

application does not start.

My whole gradle file is:

buildscript {
	ext {
		springBootVersion = '2.0.7.RELEASE'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
	}
}

plugins {
	id "org.sonarqube" version "2.5"
	id "io.franzbecker.gradle-lombok" version "1.14"
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'

group = 'com.doruk'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {

	maven {
		url "http://nexus.internal/repository/maven-public/"
	}

	maven {
		url "http://nexus.internal/repository/maven-snapshots/"
	}

	maven {
		url "http://nexus.internal/repository/maven-releases/"
	}
	mavenCentral()
	jcenter()
}

ext {
	springCloudVersion = 'Finchley.SR2'
}

configurations {
	integrationTestCompile.extendsFrom testCompile
	integrationTestRuntime.extendsFrom testRuntime
}

dependencies {
	implementation('org.springframework.boot:spring-boot-starter-actuator')
	implementation('org.springframework.boot:spring-boot-starter-web')
	implementation("org.springframework.boot:spring-boot-starter-data-jpa")
	implementation('org.springframework.cloud:spring-cloud-starter-sleuth')
	implementation('org.springframework.cloud:spring-cloud-starter-zipkin')
	implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
	implementation group: 'ch.qos.logback.contrib', name: 'logback-json-classic', version: '0.1.5'
	implementation group: 'ch.qos.logback.contrib', name: 'logback-jackson', version: '0.1.5'
	implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.24'
	implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
	implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
	implementation group: 'com.oracle', name: 'ojdbc', version: '6.0'
	compileOnly('org.projectlombok:lombok')
	testImplementation('org.springframework.boot:spring-boot-starter-test')
	integrationTestCompile('org.springframework.boot:spring-boot-starter-test')
	integrationTestCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '2.1.6'
	integrationTestCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
	integrationTestCompile group: 'ch.qos.logback.contrib', name: 'logback-json-classic', version: '0.1.5'
	integrationTestCompile group: 'ch.qos.logback.contrib', name: 'logback-jackson', version: '0.1.5'
	integrationTestCompile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
}

dependencyManagement {
	imports {
		mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
	}
}

sonarqube {
	properties {
		property "sonar.jacoco.itReportPath", "$buildDir/jacoco/integrationTest.exec"
	}
}

sourceSets {
	integrationTest {
		java {
			compileClasspath += main.output + test.output
			runtimeClasspath += main.output + test.output
			srcDir file('src/integration-test/java')
		}
		resources.srcDir file('src/integration-test/resources')
	}
}
sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir
sourceSets.test.output.resourcesDir = sourceSets.test.output.classesDir
sourceSets.integrationTest.output.resourcesDir = sourceSets.integrationTest.output.classesDir

task integrationTest(type: Test) {
	testClassesDir = sourceSets.integrationTest.output.classesDir
	classpath = sourceSets.integrationTest.runtimeClasspath
}


check.dependsOn integrationTest
integrationTest.mustRunAfter test

bootJar {
	mainClassName = "com.doruk.customer.Main"
}

It works perfecty without spring-boot-starter-jpa, however if add it, when i run it stuck in

{"timestamp":"2018-12-24 03:00:31.400","level":"INFO","thread":"main","logger":"com.doruk.customer.Main","message":"No active profile set, falling back to default profiles: default","context":"default"}

I try to add specific version of dependency like:

implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.0.7.RELEASE'

and it didnt worked.

I also tried to delete my whole .gradle folder, and download again.

Application fetch dependencies from nexus.

How can I solve it?

1 Answer 1

0

You must have one dpendency only. I noticed that you have added that dependecy.

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    implementation('org.springframework.boot:spring-boot-starter-web')
    implementation("org.springframework.boot:spring-boot-starter-data-jpa") //here

Then you shouldn't add it again.

Sign up to request clarification or add additional context in comments.

7 Comments

I didnt add that dependency twice, my whole gradle post gives me error. If i extract implementation('org.springframework.boot:spring-boot-starter-web') it run.
Ok, I will update my answer, why do you need that dependecy?
I am using for create Entity, which is necessary annotions in persistence api
Sure! but so why are you using reserved word implementation that is used in project on Android OS?
However even I dont add code to my project. It doesnt start, it stuck at start when I add jpa dependency in gradle. I mean I am not using jpa currently.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.