Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Spring CLI to run stubs locally #37

Closed
marcingrzejszczak opened this issue Jul 15, 2016 · 14 comments
Closed

Use Spring CLI to run stubs locally #37

marcingrzejszczak opened this issue Jul 15, 2016 · 14 comments

Comments

@marcingrzejszczak
Copy link
Contributor

For the case where the consumer wants to prototype the API it would be good for them to immediately install and run stubs from the contracts.

E.g. installing

spring cloud contract install /Users/path/to/contracts/ 'groupid.a.b.c' 'artifactid.d.e.f' '1.0.0.BUILD-SNAPSHOT'

E.g. running

spring cloud contract run /Users/path/to/contracts/ 'groupid.a.b.c' 'artifactid.d.e.f' '1.0.0.BUILD-SNAPSHOT'
@jkubrynski
Copy link
Contributor

Currently you can run stubs using maven, even if you don't have pom.xml:

cd /tmp
mvn spring-cloud-contract-verifier:run -Dstubs="groupid.a.b.c"

@marcingrzejszczak
Copy link
Contributor Author

It would be really awesome also to use spring cloud cli to download stub runner boot and pass some parameters to it

@simonzhong1985
Copy link

@jkubrynski when I run "mvn spring-cloud-contract-verifier:run -Dstubs="groupid.a.b.c"" under such folder where there is no pom.xml and no contracts. Although the goal is successful, I found such log "Launching StubRunner with contracts from c:\empty_folder" and "Started stub server for project **** on port -1". as you see the port is -1, I can't access the stub runner via -1 port. Could you give me some suggestion to run stub runner via mvn?

@marcingrzejszczak
Copy link
Contributor Author

Can you show how your contracts look like?

@simonzhong1985
Copy link

simonzhong1985 commented Jun 26, 2017

@marcingrzejszczak Does it mean it is necessary to run "mvn spring-cloud-contract-verifier:run " under such folder it has to contain contracts?The folder to run "mvn spring-cloud-contract-verifier:run " has no contracts. I want to run "mvn spring-cloud-contract-verifier:run" under non-jvm project to run stub runner in advance. and then no-jvm project can send message to stub runner. My contracts are saved on one common repository. Once commit is pushed to the common repository, ***.jar and ***-stub.jar will be upload to remote maven repository.

@jkubrynski
Copy link
Contributor

@simonzhong1985 it's exactly how it works but you need to use a different property. As documented here you should pass -Dspring.cloud.contract.verifier.stubs=com.aaa:bb

@simonzhong1985
Copy link

simonzhong1985 commented Jun 26, 2017

@jkubrynski thanks for your answer. It works, Now I can download stubs by -Dspring.cloud.contract.verifier.stubs=com.aaa:bb. However, It does not work by -Dspring.cloud.contract.verifier.http.port to run wiremock on assigned port.

Note: I used Spring Cloud Contract Plugin 1.1.1-Release.

@marcingrzejszczak
Copy link
Contributor Author

marcingrzejszczak commented Jun 26, 2017

You should pass the port in the ids -Dspring.cloud.contract.verifier.stubs=com.aaa:bb:+:stubs:1234. That way you'll run the stubs groupid com.aaa, artifact id bb , version + - latest, classifier stubs, port 1234

@simonzhong1985
Copy link

@marcingrzejszczak thanks. It works as I expect. Thanks again.

@simonzhong1985
Copy link

@marcingrzejszczak Is there any update about using spring cli to run stub?

@marcingrzejszczak
Copy link
Contributor Author

Yeah, thanks for trying it out. Thanks to you, we've got these things that popped up - #340 and #341

As for the update - I haven't done any work on the spring cli. Come to think of it maybe we should stick to maven since we already have some implementation there. It's easier to download and install maven instead of installing spring cli + the cloud extension.

@marcingrzejszczak
Copy link
Contributor Author

I think we should add the Stub Runner application to the Spring Cloud CLI project. The rest should be done via Maven

@marcingrzejszczak marcingrzejszczak changed the title Use Spring CLI to install and run stubs locally Use Spring CLI to run stubs locally Aug 23, 2017
@marcingrzejszczak
Copy link
Contributor Author

Done via spring-cloud/spring-cloud-cli#65

@GurushanthGowdar
Copy link

GurushanthGowdar commented Apr 10, 2023

Hi @marcingrzejszczak @jkubrynski ,
if I run the
mvn spring-cloud-contract-verifier:run -Dspring.cloud.contract.verifier.stubs=com.example:SCC_producer:+:stubs:8080

In a directory which does not have any pom.xml file I am facing the issue of the plugin.

No plugin found for prefix 'spring-cloud-contract-verifier' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/gurushantha.rg/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants