0
votes

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

1 Answers

0
votes

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.