Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:50
    fdw commented #1204
  • Dec 04 15:07
    marcingrzejszczak closed #1378
  • Dec 04 15:07
    marcingrzejszczak commented #1378
  • Dec 04 14:22
    shanman190 commented #1243
  • Dec 04 14:21
    shanman190 commented #1243
  • Dec 04 14:07
    shanman190 commented #1243
  • Dec 04 14:05
    TYsewyn closed #1532
  • Dec 04 14:05
    TYsewyn commented #1532
  • Dec 04 14:05
    TYsewyn closed #1528
  • Dec 04 14:05
    TYsewyn commented #1528
  • Dec 04 13:59
    shanman190 commented #1528
  • Dec 04 13:58
    shanman190 commented #1532
  • Dec 04 04:46
    CircleCI success: spring-cloud build (#11698) in https://github.com/spring-cloud/spring-cloud-contract
    • null
      (7804933b21d69a3c61a3198fe297f1f2e65ff38c by null)
  • Dec 04 04:23
    CircleCI failed: spring-cloud build (#11699) in https://github.com/spring-cloud/spring-cloud-contract
    • fix: pom.xml to reduce vulnerabilities
      (361fc3ee639aeb9988758edffb3160a6886fb741 by snyk-bot)
  • Dec 04 04:14
    spring-issuemaster labeled #1573
  • Dec 04 04:11
    pivotal-issuemaster commented #1573
  • Dec 04 04:11
    snyk-bot opened #1573
  • Dec 04 04:11

    OlgaMaciaszek on snyk-fix-e27f3765d671743e24e1cfebdb6e9f0d

    fix: pom.xml to reduce vulnerab… (compare)

  • Dec 04 04:11

    OlgaMaciaszek on snyk-fix-e27f3765d671743e24e1cfebdb6e9f0d

    (compare)

  • Dec 03 13:08
    Daemon2017 closed #1572
Diana Deliu
@diana-deliu
still does not work yes, nor on Jenkins, or on my local.
On my local I just try gradle clean build on the contract-tests module or on the root module.
Marcin Grzejszczak
@marcingrzejszczak
BTW whay do you need this
classpath('org.apache.maven.resolver:maven-resolver-api:1.3.3') ?
also can you run ./gradlew dependencies > log.log and paste the result here?
Diana Deliu
@diana-deliu

I deleted it, still same.

Pasting the logs:


> Task :dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

No configurations

A web-based, searchable dependency report is available by adding the --scan option.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.6.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Marcin Grzejszczak
@marcingrzejszczak
please run dependencies task against the project that has the contract tests in it
Diana Deliu
@diana-deliu
sorry about that.

> Task :dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies

apiElements - API elements for main. (n)
No dependencies

archives - Configuration for archive artifacts.
No dependencies

compile - Dependencies for source set 'main' (deprecated, use 'implementation' instead).
No dependencies

compileClasspath - Compile classpath for source set 'main'.
No dependencies

compileOnly - Compile only dependencies for source set 'main'.
No dependencies

default - Configuration for default artifacts.
No dependencies

implementation - Implementation only dependencies for source set 'main'. (n)
No dependencies

runtime - Runtime dependencies for source set 'main' (deprecated, use 'runtimeOnly' instead).
No dependencies

runtimeClasspath - Runtime classpath of source set 'main'.
No dependencies

runtimeElements - Elements of runtime for main. (n)
No dependencies

runtimeOnly - Runtime only dependencies for source set 'main'. (n)
No dependencies

testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies

testCompile - Dependencies for source set 'test' (deprecated, use 'testImplementation' instead).
No dependencies
testCompileClasspath - Compile classpath for source set 'test'.
\--- org.springframework.cloud:spring-cloud-starter-contract-verifier -> 2.2.4.RELEASE
     +--- org.springframework.cloud:spring-cloud-contract-verifier:2.2.4.RELEASE
     |    +--- org.springframework.cloud:spring-cloud-contract-spec:2.2.4.RELEASE
     |    |    +--- org.springframework.cloud:spring-cloud-contract-spec-java:2.2.4.RELEASE
     |    |    |    +--- org.codehaus.groovy:groovy:2.5.10
     |    |    |    +--- org.springframework:spring-core:5.2.8.RELEASE
     |    |    |    |    \--- org.springframework:spring-jcl:5.2.8.RELEASE
     |    |    |    +--- dk.brics.automaton:automaton:1.11-8
     |    |    |    +--- org.apache.commons:commons-text:1.7
     |    |    |    |    \--- org.apache.commons:commons-lang3:3.9
     |    |    |    \--- org.springframework:spring-jcl:5.2.8.RELEASE
     |    |    \--- org.springframework.cloud:spring-cloud-contract-spec-groovy:2.2.4.RELEASE
     |    |         +--- org.springframework.cloud:spring-cloud-contract-spec-java:2.2.4.RELEASE (*)
     |    |         +--- org.codehaus.groovy:groovy:2.5.10
     |    |         +--- org.codehaus.groovy:groovy-nio:2.5.10
     |    |         |    \--- org.codehaus.groovy:groovy:2.5.10
     |    |         +--- org.codehaus.groovy:groovy-json:2.5.10
     |    |         |    \--- org.codehaus.groovy:groovy:2.5.10
     |    |         +--- org.codehaus.groovy:groovy-xml:2.5.10
     |    |         |    \--- org.codehaus.groovy:groovy:2.5.10
     |    |         +--- org.apache.commons:commons-text:1.7 (*)
     |    |         \--- org.springframework:spring-jcl:5.2.8.RELEASE
     |    +--- org.springframework.cloud:spring-cloud-contract-shade:2.2.4.RELEASE
     |    +--- org.springframework.boot:spring-boot-test-autoconfigure:2.3.2.RELEASE
     |    |    +--- org.springframework.boot:spring-boot:2.3.2.RELEASE
     |    |    |    +--- org.springframework:spring-core:5.2.8.RELEASE (*)
     |    |    |    \--- org.springframework:spring-context:5.2.8.RELEASE
     |    |    |         +--- org.springframework:spring-aop:5.2.8.RELEASE
     |    |    |         |    +--- org.springframework:spring-beans:5.2.8.RELEASE
     |    |    |         |    |    \--- org.springframework:spring-core:5.2.8.RELEASE (*)
     |    |    |         |    \--- org.springframework:spring-core:5.2.8.RELEASE (*)
     |    |    |         +--- org.springframework:spring-beans:5.2.8.RELEASE (*)
     |    |    |         +--- org.springframework:spring-core:5.2.8.RELEASE (*)
     |    |    |         \--- org.springframework:spring-expression:5.2.8.RELEASE
     |    |    |              \--- org.springframework:spring-core:5.2.8.RELEASE (*)
     |    |    +--- org.springframework.boot:spring-boot-test:2.3.2.RELEASE
     |    |    |    \--- org.springframework.boot:spring-boot:2.3.2.RELEASE (*)
     |    |    \--- org.springframework.boot:spring-boot-autoconfigure:2.3.2.RELEASE
     |    |         \--- org.springframework.boot:spring-boot:2.3.2.RELEASE (*)
     |    +--- com.fasterxml.jackson.core:jackson-databind:2.11.1
     |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.11.1
     |    |    \--- com.fasterxml.jackson.core:jackson-core:2.11.1
     |    +--- javax.inject:javax.inject:1
     |    +--- com.github.tomakehurst:wiremock-jre8-standalone:2.26.2
Marcin Grzejszczak
@marcingrzejszczak
Everything looks fine
Diana Deliu
@diana-deliu
it's a lot more, but it's successful in the end. unfortunately it seems to be way to big to paste it here
Marcin Grzejszczak
@marcingrzejszczak
this class org.springframework.cloud.contract.verifier.util.ContractVerifierUtil is there in spring-cloud-contract-verifier since 2.1.0
your Gradle version is 5.4.x
can you upgrade to the latest ? 6.7 it is
Diana Deliu
@diana-deliu

sure, upgraded it:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

still, no luck.

same
ERROR:package org.springframework.cloud.contract.spec does not exist
Marcin Grzejszczak
@marcingrzejszczak
so when you run ./gradlew --version you get 6.7 ? Sorry for asking basic questions but I really don't understand why this is not working
this is interesting \--- org.springframework.cloud:spring-cloud-starter-contract-verifier -> 2.2.4.RELEASE
doesn't actually mean that we upgraded it to 2.2.4.RELEASE ? Are you defining the plugin somewhere else too?
Diana Deliu
@diana-deliu

This is the build.gradle from the contracts repo:

plugins {
    id 'maven-publish'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'base'
    id 'java'
}

allprojects {
    group = 'com.ebrd'
    version = project.hasProperty('releaseVersion') ? "${releaseVersion}" : '0.0.0-local'

    repositories {
        mavenLocal()
        maven { url 'http://nexus.az.ebrd.com:8081/repository/ebrd-maven-public'
            credentials {
                username = "${mavenUser}"
                password = "${mavenPassword}"
            }
        }
        maven { url 'http://repo.spring.io/milestone' }
        mavenCentral()
    }

}

subprojects {
    apply plugin: 'io.spring.dependency-management'
    apply plugin: 'java-library'
    apply plugin: 'project-report'

    ext {
        springCloudVersion = "2.2.2.RELEASE"
    }

    sourceCompatibility = '11'

    configurations {
        developmentOnly
        runtimeClasspath {
            extendsFrom developmentOnly
        }
        compileOnly {
            extendsFrom annotationProcessor
        }
    }

    dependencies {
        implementation platform("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}")

        testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-verifier'

    }

}

task copyJava(type: Copy) {
    from "src/test/java"
    into "$buildDir/resources/main/contracts"
}
jar.dependsOn("copyJava")

publishing {
    publications {
        springContractJar(MavenPublication) {
            artifact jar
        }
    }
    repositories {
        maven {
            url 'http://nexus.az.ebrd.com:8081/repository/ebrd-maven-releases/'
            credentials {
                username = "${mavenUser}"
                password = "${mavenPassword}"
            }
        }
    }
}

repositories {
    mavenLocal()
    maven { url 'http://nexus.az.ebrd.com:8081/repository/ebrd-maven-public'
        credentials {
            username = "${mavenUser}"
            password = "${mavenPassword}"
        }
    }
    maven { url 'http://repo.spring.io/milestone' }
    mavenCentral()
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR9"
    }
}

It seemed that someone added a duplicate of the spring-cloud-contract-verifier, so it was a dupe here, in this build.gradle. Deleted it and also changed to Hoxton.SR9 and generated the tests yet again.

Nothing changed.

Also, now if i try this: gradlew dependencies > log.log, the output is the following:

> Task :dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies

apiElements - API elements for main. (n)
No dependencies

archives - Configuration for archive artifacts.
No dependencies

compile - Dependencies for source set 'main' (deprecated, use 'implementation' instead).
No dependencies

compileClasspath - Compile classpath for source set 'main'.
No dependencies

compileOnly - Compile only dependencies for source set 'main'.
No dependencies

default - Configuration for default artifacts.
No dependencies

implementation - Implementation only dependencies for source set 'main'. (n)
No dependencies

runtime - Runtime dependencies for source set 'main' (deprecated, use 'runtimeOnly' instead).
No dependencies

runtimeClasspath - Runtime classpath of source set 'main'.
No dependencies

runtimeElements - Elements of runtime for main. (n)
No dependencies

runtimeOnly - Runtime only dependencies for source set 'main'. (n)
No dependencies

testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies

testCompile - Dependencies for source set 'test' (deprecated, use 'testImplementation' instead).
No dependencies

testCompileClasspath - Compile classpath for source set 'test'.
No dependencies

testCompileOnly - Compile only dependencies for source set 'test'.
No dependencies

testImplementation - Implementation only dependencies for source set 'test'. (n)
No dependencies

testRuntime - Runtime dependencies for source set 'test' (deprecated, use 'testRuntimeOnly' instead).
No dependencies

testRuntimeClasspath - Runtime classpath of source set 'test'.
No dependencies

testRuntimeOnly - Runtime only dependencies for source set 'test'. (n)
No dependencies

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Oddly enough, huh? :(
Marcin Grzejszczak
@marcingrzejszczak
springCloudVersion = "2.2.2.RELEASE" whis is wrong - the dependency should be Hoxton.SR9
this is messed up
Diana Deliu
@diana-deliu
thanks for all your help.
I think it would be helpful if I could provide you with a zip of a sample code - we really have to use the contract-tests and something very fishy is happening here since we cannot get it done. Is there any other channel where I can send you the code?
Marcin Grzejszczak
@marcingrzejszczak
Hey @diana-deliu I've sent you a dm
Ilja Pavlovs
@iljapavlovs
Hey guys! quick question - so in order to publish contracts from Producer side to binary storage like Artifactory in Gradle, I need to use maven-publish plugin and setup publishing on my own? There is no built-in Gradle task for this?
Marcin Grzejszczak
@marcingrzejszczak
yes
Ilja Pavlovs
@iljapavlovs
It's quite a pity that this configuration is missing just in a form of simple sample, I have checked all the documentation possible and found nothing. I understand that this is not responsibility of SCC, but nevertheless, you have got all kinds of tutorials, but this trivial stuff is still missing. At least you could have stated smth like "for stub publishing please check maven-publish plugin for how to publish an artefact" in your docs. This would saved me some time of googling
Marcin Grzejszczak
@marcingrzejszczak
have you checked one of 30 samples we have? https://github.com/spring-cloud-samples/spring-cloud-contract-samples
Ilja Pavlovs
@iljapavlovs
yes
so I don't understand your problem - you can copy paste the code from the samples
https://docs.spring.io/spring-cloud-contract/docs/2.2.5.RELEASE/reference/htmlsingle/#gradle-default-setup - alsow e describe it here. I don't understand the issue really. You have all sources both in the docs and in the samples.
Ilja Pavlovs
@iljapavlovs

@marcingrzejszczak have I understood correctly that

    contractRepository {
        repositoryUrl.set("http://nexus.az.ebrd.com:8081/repository/ebrd-maven-public/")
        username.set("${mavenUser}")
        password.set("${mavenPassword}")
    }

configuration is for SCM, when you use GIT to store contracts and using Artifactory in this case is wrong?

Marcin Grzejszczak
@marcingrzejszczak
where did you get this information from?
if you set this then you might want to fetch the contracts from that repo
Ilja Pavlovs
@iljapavlovs
yes, so this is for fetching the contracts, not for uploading
Marcin Grzejszczak
@marcingrzejszczak
yes
George Theofanous
@ael1930
Hello, quick question hopefully:
I'm running consumer tests and want to download the stubs from a remote location. I can see that I can specify the repository root, username and password using stubRunner.repositoryRoot, stubrunner.username and stubrunner.password in my properties file, and that works perfectly but is there not a way to configure these in my build.gradle in the same way we can configure the location from which to download the contracts on the producer side?
Marcin Grzejszczak
@marcingrzejszczak
you can pass it as a system property or an env var
roland-xwyy
@roland-xwyy

Hi,

We are using shared contracts project with following folder structure

| service-A (producer)
|| service-C (service-C is consumer of service A)
| service-B (producer)
|| service-A (service-A is consumer of service-B)

And in service-A we have configured contractsPath as ‘service-A’ .it picks up contracts from folder service-A/service-C and generates tests which is wanted, but also from under service-B/service-A. And tests generated from latter are obviously failing in service-A

Is this expected behaviour? Do we have incorrect contracts structure?

Marcin Grzejszczak
@marcingrzejszczak
Can you create a sample that replicates this?
roland-xwyy
@roland-xwyy

I’ll try to explain myself better.
We have a central contracts (gradle) project which has following structure

| service-A (producer)
|| service-C (service-C is consumer of service A)
||| contractA.groovy
| service-B (producer)
|| service-A (service-A is consumer of service-B)
||| contractB.groovy

In essence we have two producers (service-A and service-B) and

service-A consumers are:
Service-C
Service-B consumers are:
Service-A

Service-A is both consumer and producer then

Service-A is a grade project, for which the plugin config is following:

contracts {
contractDependency {
stringNotation = 'com.bla:api-contracts:+:'
}
contractsMode = "REMOTE"
basePackageForTests = "com.bla.contracttests"
contractsPath = "service-A"
contractRepository {
repositoryUrl.set("*")
username.set("
")
password.set("**")
}
baseClassMappings {
baseClassMapping(".
.*", "com.bla.ContractVerifierBase")
}
}

And problem we’re facing is that contract tests are generated in service-A for both contractA AND contractB, although it should only generate contractA tests, for which it’s a producer, but picks up contracts also from service-B/service-A, for which it's a consumer

Marcin Grzejszczak
@marcingrzejszczak
ok I get it. If you follow the predefined structure then you shouldn't need ot pass the contractsPath
it will be automatically resolved from group id / artifact id afair
roland-xwyy
@roland-xwyy

Removing 'contractsPath' setting results in no tests being generated

Just as a note, root dir for our groovy contracts in central api-contracts project is following:

rootDir/src/main/resources/contracts

And I also tried setting 'contractsDslDir' as file("${project.rootDir}/src/main/resources/contracts") or file("${project.rootDir}/src/main/resources/contracts/service-A") in service-A

But I guess 'contractsDslDir' applies if you're hosting contracts in same project?

but still no tests are generated in service-A, when contractsPath is not specified

Marcin Grzejszczak
@marcingrzejszczak
Can you create a small project that replicates this issue? That would be super helpful
roland-xwyy
@roland-xwyy
Workaround for us was to rename consumer folders with suffix '-consumer' which prevents them to be picked up when downloading contracts and generating producer tests in producer service
Rod McCutcheon
@rodmccutcheon

Is there anything special that needs to happen to test dynamic routing in spring-cloud-stream with spring-cloud-contract?

@Bean
    public Function<Collection<GatewayNotification>, Collection<Message<GatewayNotification>>> route() {
        return gatewayNotifications -> gatewayNotifications.stream().map(gatewayNotification -> MessageBuilder
                .withPayload(gatewayNotification)
                .setHeader("spring.cloud.stream.sendto.destination", convertCamelCaseToSnakeCase(gatewayNotification.getClass().getSimpleName()))
                .build()).collect(Collectors.toUnmodifiableList());
    }
 spring:
  cloud:   
    stream:
      bindings:
        parse|route-in-0:
          destination: input
      function:
        definition: parse|route
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dali_status_notifications' available

I've successfully test the input-output contract with a fixed route.

Marcin Grzejszczak
@marcingrzejszczak
I don't think we tested it
what's the contract?