diff --git a/docs/src/main/asciidoc/gradle-project.adoc b/docs/src/main/asciidoc/gradle-project.adoc
index 03c93c86b5..ab32951619 100644
--- a/docs/src/main/asciidoc/gradle-project.adoc
+++ b/docs/src/main/asciidoc/gradle-project.adoc
@@ -35,8 +35,75 @@ To add a Gradle plugin with dependencies, you can use code similar to the follow
====
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
-.Plugin DSL
+.Plugin DSL GA versions
----
+// build.gradle
+plugins {
+ id "groovy"
+ // this will work only for GA versions of Spring Cloud Contract
+ id "org.springframework.cloud.contract" version "${GAVerifierVersion}"
+}
+
+dependencyManagement {
+ imports {
+ mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:${GAVerifierVersion}"
+ }
+}
+
+dependencies {
+ testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
+ // example with adding Spock core and Spock Spring
+ testCompile "org.spockframework:spock-core:${spockVersion}"
+ testCompile "org.spockframework:spock-spring:${spockVersion}"
+ testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
+}
+----
+
+[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
+.Plugin DSL non GA versions
+----
+// settings.gradle
+pluginManagement {
+ plugins {
+ id "org.springframework.cloud.contract" version "${verifierVersion}"
+ }
+ repositories {
+ // to pick from local .m2
+ mavenLocal()
+ // for snapshots
+ maven { url "https://repo.spring.io/snapshot" }
+ // for milestones
+ maven { url "https://repo.spring.io/milestone" }
+ // for GA versions
+ gradlePluginPortal()
+ }
+}
+
+// build.gradle
+plugins {
+ id "groovy"
+ id "org.springframework.cloud.contract"
+}
+
+dependencyManagement {
+ imports {
+ mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:${verifierVersion}"
+ }
+}
+
+dependencies {
+ testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
+ // example with adding Spock core and Spock Spring
+ testCompile "org.spockframework:spock-core:${spockVersion}"
+ testCompile "org.spockframework:spock-spring:${spockVersion}"
+ testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
+}
+----
+
+[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
+.Legacy Plugin Application
+----
+// build.gradle
buildscript {
repositories {
mavenCentral()
@@ -44,6 +111,8 @@ buildscript {
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifier_version}"
+ // here you can also pass additional dependencies such as Pact or Kotlin spec e.g.:
+ // classpath "org.springframework.cloud:spring-cloud-contract-spec-kotlin:${verifier_version}"
}
}
@@ -56,39 +125,6 @@ dependencyManagement {
}
}
-dependencies {
- testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
- // example with adding Spock core and Spock Spring
- testCompile "org.spockframework:spock-core:${spockVersion}"
- testCompile "org.spockframework:spock-spring:${spockVersion}"
- testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
-}
-----
-
-[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
-.Legacy Plugin Application
-----
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
- }
-}
-
-apply plugin: 'groovy'
-
-plugins {
- id "org.springframework.cloud.contract" version "${GAVerifierVersion}"
-}
-
-dependencyManagement {
- imports {
- mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:${verifier_version}"
- }
-}
-
dependencies {
testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
// example with adding Spock core and Spock Spring
@@ -99,8 +135,6 @@ dependencies {
----
====
-IMPORTANT: The Plugin DSL option will only work for GA (General Availability) releases (i.e. `2.2.0.RELEASE` etc.).
-
[[gradle-and-rest-assured]]
== Gradle and Rest Assured 2.0
diff --git a/samples/standalone/dsl/http-server/build.gradle b/samples/standalone/dsl/http-server/build.gradle
index 9a82dcc928..99b1b82d1a 100644
--- a/samples/standalone/dsl/http-server/build.gradle
+++ b/samples/standalone/dsl/http-server/build.gradle
@@ -1,4 +1,25 @@
// tag::repos[]
+/*
+ We need to use the [buildscript {}] section when we have to modify
+ the classpath for the plugins. If that's not the case this section
+ can be skipped.
+
+ If you don't need to modify the classpath (e.g. add a Pact dependency),
+ then you can just set the [pluginManagement {}] section in [settings.gradle] file.
+
+ // settings.gradle
+ pluginManagement {
+ repositories {
+ // for snapshots
+ maven {url "https://repo.spring.io/snapshot"}
+ // for milestones
+ maven {url "https://repo.spring.io/milestone"}
+ // for GA versions
+ gradlePluginPortal()
+ }
+ }
+
+ */
buildscript {
repositories {
mavenCentral()
diff --git a/samples/standalone/webclient/http-server/build.gradle b/samples/standalone/webclient/http-server/build.gradle
index 83d8c67d4d..3131a01d12 100644
--- a/samples/standalone/webclient/http-server/build.gradle
+++ b/samples/standalone/webclient/http-server/build.gradle
@@ -1,17 +1,10 @@
-buildscript {
- repositories {
- mavenCentral()
- mavenLocal()
- maven { url "https://repo.spring.io/snapshot" }
- maven { url "https://repo.spring.io/milestone" }
- maven { url "https://repo.spring.io/release" }
- maven { url 'https://repo.spring.io/plugins-snapshot' }
- maven { url "https://repo.spring.io/plugins-release-local" }
- maven { url "https://repo.spring.io/plugins-staging-local/" }
- }
- dependencies {
- classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}"
- }
+plugins {
+ id "groovy"
+ id "org.springframework.boot"
+ id "io.spring.dependency-management"
+ id "maven-publish"
+ id "maven"
+ id "org.springframework.cloud.contract"
}
group = 'com.example'
@@ -25,12 +18,6 @@ repositories {
maven { url "https://repo.spring.io/release" }
}
-apply plugin: 'groovy'
-apply plugin: 'org.springframework.boot'
-apply plugin: 'io.spring.dependency-management'
-apply plugin: 'maven-publish'
-apply plugin: 'maven'
-
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION"
@@ -47,6 +34,10 @@ dependencies {
testCompile 'org.springframework.cloud:spring-cloud-contract-wiremock'
}
+contracts {
+ failOnNoContracts = false
+}
+
test {
systemProperty 'spring.profiles.active', 'gradle'
testLogging {
diff --git a/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.jar
index 87b738cbd0..5c2d1cf016 100644
Binary files a/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.properties
index b0acbdcd73..7c4388a921 100644
--- a/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.properties
+++ b/samples/standalone/webclient/http-server/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/samples/standalone/webclient/http-server/gradlew b/samples/standalone/webclient/http-server/gradlew
index af6708ff22..83f2acfdc3 100755
--- a/samples/standalone/webclient/http-server/gradlew
+++ b/samples/standalone/webclient/http-server/gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m"'
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
diff --git a/samples/standalone/webclient/http-server/gradlew.bat b/samples/standalone/webclient/http-server/gradlew.bat
index 0f8d5937c4..24467a141f 100644
--- a/samples/standalone/webclient/http-server/gradlew.bat
+++ b/samples/standalone/webclient/http-server/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m"
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
diff --git a/samples/standalone/webclient/http-server/settings.gradle b/samples/standalone/webclient/http-server/settings.gradle
index 2cc07be60c..deaca9637d 100644
--- a/samples/standalone/webclient/http-server/settings.gradle
+++ b/samples/standalone/webclient/http-server/settings.gradle
@@ -1 +1,26 @@
+pluginManagement {
+ plugins {
+ id 'org.springframework.boot'
+ id "org.springframework.cloud.contract" version "${verifierVersion}"
+ id "io.spring.dependency-management" version "1.0.8.RELEASE"
+ }
+ repositories {
+ // to pick from local .m2
+ mavenLocal()
+ // for snapshots
+ maven { url "https://repo.spring.io/libs-snapshot-local" }
+ // for milestones
+ maven { url "https://repo.spring.io/libs-milestone-local" }
+ // for GA versions
+ gradlePluginPortal()
+ }
+ resolutionStrategy {
+ eachPlugin {
+ if (requested.id.id == 'org.springframework.boot') {
+ useModule("org.springframework.boot:spring-boot-gradle-plugin:${bootVersion}")
+ }
+ }
+ }
+}
rootProject.name = 'http-server-webclient-gradle'
+
diff --git a/spring-cloud-contract-tools/pom.xml b/spring-cloud-contract-tools/pom.xml
index 62ca07043c..5db9fa442f 100644
--- a/spring-cloud-contract-tools/pom.xml
+++ b/spring-cloud-contract-tools/pom.xml
@@ -22,6 +22,7 @@
spring-cloud-contract-pact
spring-cloud-contract-maven-plugin
spring-cloud-contract-gradle-plugin
+ spring-cloud-contract-gradle-portal-plugin
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar
index 87b738cbd0..5c2d1cf016 100644
Binary files a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar and b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
index b0acbdcd73..7c4388a921 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew
index af6708ff22..83f2acfdc3 100755
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m"'
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat
index 0f8d5937c4..24467a141f 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m"
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/ContractsCopyTask.groovy b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/ContractsCopyTask.groovy
index b3210a46b0..32863a1ef4 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/ContractsCopyTask.groovy
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/ContractsCopyTask.groovy
@@ -16,6 +16,7 @@
package org.springframework.cloud.contract.verifier.plugin
+import java.time.Instant
import groovy.transform.CompileStatic
import groovy.transform.Immutable
@@ -40,6 +41,7 @@ import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.WorkResult
+
import org.springframework.cloud.contract.stubrunner.ContractDownloader
import org.springframework.cloud.contract.stubrunner.StubConfiguration
import org.springframework.cloud.contract.stubrunner.StubDownloader
@@ -48,8 +50,6 @@ import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties
import org.springframework.cloud.contract.verifier.converter.ToYamlConverter
import org.springframework.util.StringUtils
-import java.time.Instant
-
// TODO: Convert to incremental task: https://docs.gradle.org/current/userguide/custom_tasks.html#incremental_tasks
/**
* Task that copies the contracts in order for the jar task to
@@ -77,6 +77,7 @@ class ContractsCopyTask extends DefaultTask {
Provider excludeBuildFolders
@Input
Provider failOnNoContracts
+ String contractsDirectoryPath
Provider contractsDirectory
// All fields inside `@Nested` one are properly marked as an `@Input` to work with incremental build:
@Nested
@@ -95,32 +96,42 @@ class ContractsCopyTask extends DefaultTask {
@Input
@Optional
Property contractsPath
+
@Input
@Optional
Instant getForceDownloadOfTheLatestContracts() {
// If we have `dynamic` version (`+` or `SNAPSHOT`) - we should mark this task as out of date for every run:
if (shouldDownloadContracts() && getStubConfiguration().isVersionChanging()) {
return Instant.now() // This will trigger re-download of contracts
- } else {
+ }
+ else {
return null // This will not trigger re-download of contracts
}
}
+
@Optional
@InputDirectory
Provider getContractsDirectory() {
- if (shouldDownloadContracts()) {
+ contractsDirectoryPath = contractsDirectory.get().asFile.absolutePath
+ if (shouldDownloadContracts() || contractFolderMissing()) {
return null
- } else {
+ }
+ else {
return contractsDirectory
}
}
+ private boolean contractFolderMissing() {
+ contractsDirectory.isPresent() && !contractsDirectory.get().asFile.exists()
+ }
+
@Internal
boolean shouldDownloadContracts() {
return StringUtils.hasText(contractDependency.getArtifactId().getOrNull()) ||
StringUtils.hasText(contractDependency.getStringNotation().getOrNull()) ||
StringUtils.hasText(contractRepository.repositoryUrl.getOrNull())
}
+
@Internal
StubConfiguration getStubConfiguration() {
return GradleContractsDownloaderHelper.stubConfiguration(contractDependency)
@@ -141,14 +152,22 @@ class ContractsCopyTask extends DefaultTask {
if (downloadedData) {
contractsDirectory = downloadedData.downloadedContracts
antPattern = "${downloadedData.inclusionProperties.includedRootFolderAntPattern}*.*"
- } else {
+ logger.info("Contracts got downloaded to [" + contractsDirectory + "]")
+ }
+ else if (config.contractsDirectory != null && config.contractsDirectory.isPresent()) {
contractsDirectory = config.contractsDirectory.get().asFile
antPattern = "**/"
}
+ else {
+ contractsDirectory = null
+ }
logger.info("For project [{}] will use contracts provided in the folder [{}]", project.name, contractsDirectory)
final String contractsRepository = config.contractRepository.repositoryUrl.isPresent() ? config.contractRepository.repositoryUrl : ""
throwExceptionWhenFailOnNoContracts(contractsDirectory, contractsRepository)
-
+ if (contractsDirectory == null) {
+ logger.info("Contracts directory not set and contracts weren't downloaded. There's nothing to copy")
+ return
+ }
final String slashSeparatedGroupId = project.group.toString().replace(".", File.separator)
final String slashSeparatedAntPattern = antPattern.replace(slashSeparatedGroupId, project.group.toString())
final File output = config.copiedContractsFolder.get().asFile
@@ -225,7 +244,8 @@ class ContractsCopyTask extends DefaultTask {
downloadedContracts: contractsSubDirIfPresent(downloadedContracts, logger),
inclusionProperties: inclusionProperties
)
- } else {
+ }
+ else {
return null
}
}
@@ -251,10 +271,9 @@ class ContractsCopyTask extends DefaultTask {
}
return
}
- if (config.failOnNoContracts.get() && (!file.exists() || file.listFiles().length == 0)) {
- throw new GradleException("Contracts could not be found: ["
- + file.getAbsolutePath()
- + "] .\nPlease make sure that the contracts were defined, or set the [failOnNoContracts] flag to [false]")
+ if (config.failOnNoContracts.get() && (file == null || !file.exists() || file.listFiles().length == 0)) {
+ String path = file != null ? file.getAbsolutePath() : config.contractsDirectoryPath
+ throw new GradleException("Contracts could not be found: [" + path + "]\nPlease make sure that the contracts were defined, or set the [failOnNoContracts] flag to [false]")
}
}
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/ContractVerifierSpec.groovy b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/ContractVerifierSpec.groovy
index 626da379fe..472fb5b584 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/ContractVerifierSpec.groovy
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/ContractVerifierSpec.groovy
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.contract.verifier.plugin
import org.gradle.api.Project
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/GradleContractsDownloaderHelperSpec.groovy b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/GradleContractsDownloaderHelperSpec.groovy
index aadb5eb074..a7d83c6f50 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/GradleContractsDownloaderHelperSpec.groovy
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/groovy/org/springframework/cloud/contract/verifier/plugin/GradleContractsDownloaderHelperSpec.groovy
@@ -1,11 +1,28 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.contract.verifier.plugin
-import org.gradle.api.internal.provider.DefaultPropertyState
+import org.gradle.api.internal.provider.DefaultProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
-import org.springframework.cloud.contract.stubrunner.StubConfiguration
import spock.lang.Specification
+import org.springframework.cloud.contract.stubrunner.StubConfiguration
+
/**
* @author Marcin Grzejszczak
* @author Anatoliy Balakirev
@@ -81,6 +98,6 @@ class GradleContractsDownloaderHelperSpec extends Specification {
// Have to use this internal property impl here. Is there some better way?
static Property prop(Class aClass) {
- return new DefaultPropertyState(aClass)
+ return new DefaultProperty(aClass)
}
}
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-portal-plugin/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-gradle-portal-plugin/pom.xml
new file mode 100644
index 0000000000..b0dd8da39c
--- /dev/null
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-portal-plugin/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+
+ org.springframework.cloud
+ spring-cloud-contract-tools
+ 2.2.0.BUILD-SNAPSHOT
+ ..
+
+
+ org.springframework.cloud.contract
+ org.springframework.cloud.contract.gradle.plugin
+ jar
+
+ Spring Cloud Contract Gradle Portal Plugin
+ Spring Cloud Contract Gradle Portal Plugin
+
+
+
+ org.springframework.cloud
+ spring-cloud-contract-gradle-plugin
+
+
+
+