Fixed Gradle project build

This commit is contained in:
Marcin Grzejszczak
2016-07-10 10:47:39 +02:00
parent a1f3eaa0af
commit d4dac7e705
5 changed files with 83 additions and 63 deletions

View File

@@ -343,9 +343,9 @@
</developers>
<scm>
<connection>scm:git:https://github.com/spring-cloud/spring-cloud-contract-verifier-maven-plugin.git</connection>
<developerConnection>scm:git:git@github.com:spring-cloud/spring-cloud-contract-verifier-maven-plugin.git</developerConnection>
<url>https://github.com/spring-cloud/spring-cloud-contract-verifier-maven-plugin</url>
<connection>scm:git:https://github.com/spring-cloud/spring-cloud-contract.git</connection>
<developerConnection>scm:git:git@github.com:spring-cloud/spring-cloud-contract.git</developerConnection>
<url>https://github.com/spring-cloud/spring-cloud-contract</url>
<tag>HEAD</tag>
</scm>

View File

@@ -15,71 +15,98 @@ buildscript {
ext {
repoUser = System.getenv('REPO_USERNAME') ?: project.findProperty('REPO_USERNAME') ?: ''
repoPass = System.getenv('REPO_PASSWORD') ?: project.findProperty('REPO_PASSWORD') ?: ''
projectsToSkipPublication = ['parent', 'samples', 'docs', 'root']
contractVerifierGradlePluginLibsDir ="$buildDir/contractVerifier-gradle-plugin-libs"
messagingLibsDir ="$buildDir/messaging-libs"
testSystemProperties = [
'contract-verifier-gradle-plugin-libs-dir': contractVerifierGradlePluginLibsDir,
'messaging-libs-dir': messagingLibsDir
]
}
allprojects {
project.version = findProperty('contractVerifierVersion') ?: '1.0.0.BUILD-SNAPSHOT'
apply from: "$rootDir/gradle/release.gradle"
apply plugin: 'groovy'
project.version = findProperty('contractVerifierVersion') ?: '1.0.0.BUILD-SNAPSHOT'
apply from: "$rootDir/gradle/release.gradle"
apply plugin: 'groovy'
group = 'org.springframework.cloud.contract'
group = 'org.springframework.cloud.contract'
sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/libs-release-local" }
maven { url "http://repo.spring.io/libs-staging-local/" }
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/libs-release-local" }
maven { url "http://repo.spring.io/libs-staging-local/" }
}
//Dependencies in all subprojects - http://solidsoft.wordpress.com/2014/11/13/gradle-tricks-display-dependencies-for-all-subprojects-in-multi-project-build/
task allDeps(type: DependencyReportTask) {}
task allInsight(type: DependencyInsightReportTask) {}
dependencies {
compile gradleApi()
compile localGroovy()
compile("org.springframework.cloud.contract:spring-cloud-contract-verifier-core:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
compile("org.springframework.cloud.contract:spring-cloud-contract-verifier-converters:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
compile("org.springframework.cloud.contract:spring-cloud-contract-stub-runner:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude(group: 'org.codehaus.groovy')
}
testCompile 'info.solidsoft.spock:spock-global-unroll:0.5.0'
testCompile gradleTestKit()
}
test {
testLogging {
exceptionFormat = 'full'
}
}
//Dependencies in all subprojects - http://solidsoft.wordpress.com/2014/11/13/gradle-tricks-display-dependencies-for-all-subprojects-in-multi-project-build/
task allDeps(type: DependencyReportTask) {}
task allInsight(type: DependencyInsightReportTask) {}
configurations {
// fixing the groovydoc issue http://stackoverflow.com/questions/20618857/gradle-task-groovydoc-failing-with-noclassdeffounderror
configurations {
jansi.extendsFrom(runtime)
jansi.extendsFrom(runtime)
contractVerifierGradlePluginLibs
messagingLibs
}
dependencies {
compile gradleApi()
compile localGroovy()
compile("org.springframework.cloud.contract:spring-cloud-contract-verifier-core:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
groovydoc {
def title = "IPDS ${version}"
groovyClasspath = project.configurations.jansi
compile("org.springframework.cloud.contract:spring-cloud-contract-verifier-converters:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
dependencies {
jansi 'org.fusesource.jansi:jansi:1.11'
compile("org.springframework.cloud.contract:spring-cloud-contract-stub-runner:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude(group: 'org.codehaus.groovy')
}
testCompile 'info.solidsoft.spock:spock-global-unroll:0.5.0'
testCompile gradleTestKit()
messagingLibs("org.springframework.cloud.contract:spring-cloud-contract-verifier-integration:${project.version}") {
exclude(group: 'org.codehaus.groovy')
}
}
test {
testLogging {
exceptionFormat = 'full'
}
systemProperties = testSystemProperties
}
groovydoc {
def title = "IPDS ${version}"
groovyClasspath = project.configurations.jansi
}
dependencies {
contractVerifierGradlePluginLibs project
jansi 'org.fusesource.jansi:jansi:1.11'
}
task archiveContractVerifierGradlePluginLibsDependencies(type: Sync) {
from configurations.contractVerifierGradlePluginLibs.resolvedConfiguration.resolvedArtifacts.collect { it.file }
into contractVerifierGradlePluginLibsDir
}
task archiveMessagingLibsDependencies(type: Sync) {
from configurations.messagingLibs.resolvedConfiguration.resolvedArtifacts.collect { it.file }
into messagingLibsDir
}
archiveContractVerifierGradlePluginLibsDependencies.dependsOn project.tasks.jar
test.dependsOn archiveContractVerifierGradlePluginLibsDependencies, archiveMessagingLibsDependencies
configurations {
all {
resolutionStrategy {

View File

@@ -5,10 +5,7 @@ ext {
resolveRepoName = { Project project ->
String version = project.version
String name = project.name
String resolvedRepoName = "libs-${resolveVersion(version)}-local"
if (name.contains("gradle")) {
resolvedRepoName = "plugins-${resolveVersion(version)}-local"
}
resolvedRepoName = "plugins-${resolveVersion(version)}-local"
logger.lifecycle("For project [$project.name] with " +
"version [$project.version] the resolved Artifactory repo is [$resolvedRepoName]")
return resolvedRepoName
@@ -85,8 +82,4 @@ afterEvaluate {
String repoPrefix() {
return project.name.contains('gradle') ? 'plugins' : 'libs'
}
if (projectsToSkipPublication.any { project.name.contains(it) }) {
uploadArchives.enabled = false
}