Clearing up the way dependencies are setup for Gradle plugin

This commit is contained in:
Marcin Grzejszczak
2017-02-02 14:32:20 +01:00
parent 79c6a2e72c
commit caf0452c4b
9 changed files with 68 additions and 65 deletions

View File

@@ -65,6 +65,9 @@ dependencies {
compile("org.springframework.cloud:spring-cloud-contract-stub-runner:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
compile("org.springframework.cloud:spring-cloud-starter-contract-verifier:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude(group: 'org.codehaus.groovy')
}

View File

@@ -72,7 +72,6 @@ class SpringCloudContractVerifierGradlePlugin implements Plugin<Project> {
createGenerateTestsTask(extension, copyContracts)
Task clientTask = createAndConfigureGenerateClientStubsFromDslTask(extension, copyContracts)
createAndConfigureGenerateWireMockClientStubsFromDslTask(extension, clientTask)
addProjectDependencies(project)
addIdeaTestSources(project, extension)
}
@@ -90,14 +89,6 @@ class SpringCloudContractVerifierGradlePlugin implements Plugin<Project> {
}
}
//TODO: Deprecate this since starting with 1.1.x
private void addProjectDependencies(Project project) {
//TODO: Consider removing this at some point
project.dependencies.add("testCompile", "com.github.tomakehurst:wiremock:2.1.7")
project.dependencies.add("testCompile", "com.toomuchcoding.jsonassert:jsonassert:0.4.8")
project.dependencies.add("testCompile", "org.assertj:assertj-core:2.3.0")
}
private void setConfigurationDefaults(ContractVerifierExtension extension) {
extension.with {
generatedTestSourcesDir = generatedTestSourcesDir ?: project.file("${project.buildDir}/generated-test-sources/contracts")

View File

@@ -57,7 +57,6 @@ abstract class ContractVerifierIntegrationSpec extends Specification {
classpath fileTree(dir: '$gradlePluginLibsDir', include: '*.jar')
}
}
""" + buildFile.text
// Extending buildscript is required when 'apply' is used.
// 'GradleRunner#withPluginClasspath' can be used when plugin is added using 'plugins { id...'

View File

@@ -109,36 +109,6 @@ class ContractVerifierSpec extends Specification {
publications.findByName("stubs") != null
}
def "should add wiremock as a testCompile dependency"() {
given:
project.plugins.apply(SpringCloudContractVerifierGradlePlugin)
expect:
project.configurations.testCompile.dependencies.find {
it.group == "com.github.tomakehurst" && it.name == "wiremock"
} != null
}
def "should add jsonassert as a testCompile dependency"() {
given:
project.plugins.apply(SpringCloudContractVerifierGradlePlugin)
expect:
project.configurations.testCompile.dependencies.find {
it.group == "com.toomuchcoding.jsonassert" && it.name == "jsonassert"
} != null
}
def "should add assertj-core as a testCompile dependency"() {
given:
project.plugins.apply(SpringCloudContractVerifierGradlePlugin)
expect:
project.configurations.testCompile.dependencies.find {
it.group == "org.assertj" && it.name == "assertj-core"
} != null
}
def "should compile"() {
given:
ContractVerifierExtension extension = new ContractVerifierExtension()

View File

@@ -2,35 +2,48 @@ buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE"
}
}
apply plugin: 'groovy'
apply plugin: 'spring-cloud-contract'
apply plugin: 'maven-publish'
apply plugin: 'spring-boot'
group = 'org.springframework.cloud.testprojects'
ext {
contractsDir = file("repository/mappings")
stubsOutputDirRoot = file("${project.buildDir}/production/${project.name}-stubs/repository/")
BOM_VERSION = "Dalston.BUILD-SNAPSHOT"
}
repositories {
mavenCentral()
mavenLocal()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/release" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION"
}
}
dependencies {
compile "org.springframework:spring-web:$springVersion"
compile "org.springframework:spring-web"
compile "org.springframework:spring-context-support:$springVersion"
compile "org.codehaus.groovy:groovy-all:2.4.5"
compile 'com.jayway.jsonpath:json-path-assert:2.2.0'
compile "org.codehaus.groovy:groovy-all"
compile 'com.jayway.jsonpath:json-path-assert'
testCompile "com.github.tomakehurst:wiremock:2.1.7"
testCompile "com.github.tomakehurst:wiremock"
testCompile "org.spockframework:spock-spring:1.0-groovy-2.4"
testCompile "com.jayway.restassured:rest-assured:$restAssuredVersion"
testCompile "com.jayway.restassured:spring-mock-mvc:$restAssuredVersion"
testCompile "ch.qos.logback:logback-classic:1.1.2"
testCompile("org.springframework.cloud:spring-cloud-starter-contract-verifier")
}
contracts {

View File

@@ -15,8 +15,5 @@
#
groupId=org.springframework.cloud.testprojects
jacksonMapper=1.9.13
restAssuredVersion=2.4.0
springVersion=4.1.7.RELEASE
springBootVersion=1.3.3.RELEASE
springBootVersion=1.4.3.RELEASE

View File

@@ -29,31 +29,40 @@ allprojects {
}
ext {
restAssuredVersion = '2.5.0'
spockVersion = '1.0-groovy-2.4'
wiremockVersion = '2.0.10-beta'
BOM_VERSION = "Dalston.BUILD-SNAPSHOT"
contractVerifierStubsBaseDirectory = 'src/test/resources/stubs'
}
subprojects {
apply plugin: 'groovy'
apply plugin: 'spring-boot'
repositories {
mavenCentral()
mavenLocal()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/release" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION"
}
}
dependencies {
testCompile 'org.codehaus.groovy:groovy-all:2.4.5'
testCompile 'org.codehaus.groovy:groovy-all'
testCompile "org.spockframework:spock-core:$spockVersion"
testCompile 'junit:junit:4.12'
testCompile "com.github.tomakehurst:wiremock:$wiremockVersion"
testCompile 'junit:junit'
testCompile "com.github.tomakehurst:wiremock"
testCompile("org.springframework.cloud:spring-cloud-starter-contract-verifier")
}
}
configure([project(':fraudDetectionService'), project(':loanApplicationService')]) {
apply plugin: 'spring-boot'
apply plugin: 'maven-publish'
ext['jetty.version'] = '9.2.17.v20160517'
@@ -81,7 +90,7 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
testCompile "org.mockito:mockito-core"
testCompile "org.springframework:spring-test"
testCompile "org.springframework.boot:spring-boot-test"
testCompile("com.github.tomakehurst:wiremock:2.1.7") {
testCompile("com.github.tomakehurst:wiremock") {
exclude group: 'org.eclipse.jetty'
}
}

View File

@@ -27,7 +27,7 @@ buildscript {
ext {
restAssuredVersion = '2.5.0'
spockVersion = '1.0-groovy-2.4'
wiremockVersion = '2.0.10-beta'
BOM_VERSION = "Dalston.BUILD-SNAPSHOT"
contractVerifierStubsBaseDirectory = 'src/test/resources/stubs'
}
@@ -36,17 +36,28 @@ group = 'org.springframework.cloud.testprojects'
subprojects {
apply plugin: 'groovy'
apply plugin: 'spring-boot'
repositories {
mavenCentral()
mavenLocal()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/release" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION"
}
}
dependencies {
testCompile "org.codehaus.groovy:groovy-all:2.4.5"
testCompile "org.spockframework:spock-core:$spockVersion"
testCompile("junit:junit:4.12")
testCompile "com.github.tomakehurst:wiremock:$wiremockVersion"
testCompile "junit:junit"
testCompile "com.github.tomakehurst:wiremock"
testCompile("org.springframework.cloud:spring-cloud-starter-contract-verifier")
}
}
@@ -86,6 +97,8 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
testCompile "org.springframework.boot:spring-boot-test"
testCompile "com.jayway.restassured:rest-assured:$restAssuredVersion"
testCompile "com.jayway.restassured:spring-mock-mvc:$restAssuredVersion"
testCompile "com.jayway.restassured:spring-mock-mvc:$restAssuredVersion"
testCompile "com.toomuchcoding.jsonassert:jsonassert:${jsonAssertVersion}"
}
task cleanup(type: Delete) {

View File

@@ -27,7 +27,7 @@ buildscript {
ext {
restAssuredVersion = '2.5.0'
spockVersion = '1.0-groovy-2.4'
wiremockVersion = '2.0.10-beta'
BOM_VERSION = "Dalston.BUILD-SNAPSHOT"
contractVerifierStubsBaseDirectory = 'src/test/resources/stubs'
}
@@ -37,17 +37,27 @@ group = 'org.springframework.cloud.testprojects'
subprojects {
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'spring-boot'
repositories {
mavenCentral()
mavenLocal()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/release" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION"
}
}
dependencies {
testCompile "org.codehaus.groovy:groovy-all:2.4.5"
testCompile "org.codehaus.groovy:groovy-all"
testCompile "org.spockframework:spock-core:$spockVersion"
testCompile("junit:junit:4.12")
testCompile "com.github.tomakehurst:wiremock:$wiremockVersion"
testCompile("org.springframework.cloud:spring-cloud-starter-contract-verifier")
}
}
@@ -107,8 +117,6 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
testCompile "org.mockito:mockito-core"
testCompile "org.springframework:spring-test"
testCompile "org.springframework.boot:spring-boot-test"
testCompile "com.jayway.restassured:rest-assured:$restAssuredVersion"
testCompile "com.jayway.restassured:spring-mock-mvc:$restAssuredVersion"
}
task cleanup(type: Delete) {