Sync docs from master to gh-pages
This commit is contained in:
BIN
images/sts_exception.png
Normal file
BIN
images/sts_exception.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
@@ -572,7 +572,6 @@ $(addBlockSwitches);
|
||||
<ul class="sectlevel5">
|
||||
<li><a href="#_add_gradle_plugin_with_dependencies">Add gradle plugin with dependencies</a></li>
|
||||
<li><a href="#_snapshot_versions_for_gradle">Snapshot versions for Gradle</a></li>
|
||||
<li><a href="#_add_maven_plugin_with_dependencies">Add maven plugin with dependencies</a></li>
|
||||
<li><a href="#_add_stubs">Add stubs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -606,6 +605,11 @@ $(addBlockSwitches);
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_invoking_generated_tests_2">Invoking generated tests</a></li>
|
||||
<li><a href="#_faq_with_maven_plugin">FAQ with Maven Plugin</a>
|
||||
<ul class="sectlevel5">
|
||||
<li><a href="#_maven_plugin_and_sts">Maven Plugin and STS</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_spring_cloud_contract_verifier_on_consumer_side_2">Spring Cloud Contract Verifier on consumer side</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -657,7 +661,11 @@ $(addBlockSwitches);
|
||||
</li>
|
||||
<li><a href="#_stub_runner_spring_cloud">Stub Runner Spring Cloud</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#_stubbing_service_discovery">Stubbing Service Discovery</a></li>
|
||||
<li><a href="#_stubbing_service_discovery">Stubbing Service Discovery</a>
|
||||
<ul class="sectlevel4">
|
||||
<li><a href="#_test_profiles_and_service_discovery">Test profiles and service discovery</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_additional_configuration">Additional Configuration</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -3017,49 +3025,6 @@ dependencies {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect5">
|
||||
<h6 id="_add_maven_plugin_with_dependencies">Add maven plugin with dependencies</h6>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-xml" data-lang="xml"><dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-dependencies</artifactId>
|
||||
<version>${spring-cloud-contract.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>convert</goal>
|
||||
<goal>generateStubs</goal>
|
||||
<goal>generateTests</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Read more: <a href="https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract-maven-plugin/">spring-cloud-contract-maven-plugin</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect5">
|
||||
<h6 id="_add_stubs">Add stubs</h6>
|
||||
<div class="paragraph">
|
||||
<p>By default Spring Cloud Contract Verifier is looking for stubs in <code>src/test/resources/contracts</code> directory.</p>
|
||||
@@ -3725,6 +3690,73 @@ will be extending the <code>com.example.ComBase</code> whereas the rest of tests
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_faq_with_maven_plugin">FAQ with Maven Plugin</h5>
|
||||
<div class="sect5">
|
||||
<h6 id="_maven_plugin_and_sts">Maven Plugin and STS</h6>
|
||||
<div class="paragraph">
|
||||
<p>In case you see the following exception while using STS</p>
|
||||
</div>
|
||||
<div class="imageblock">
|
||||
<div class="content">
|
||||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/1.0.x/docs/src/main/asciidoc/images/sts_exception.png" alt="STS Exception">
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>when you click on the marker you should see sth like this</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-bash" data-lang="bash"> plugin:1.1.0.M1:convert:default-convert:process-test-resources) org.apache.maven.plugin.PluginExecutionException: Execution default-convert of goal org.springframework.cloud:spring-
|
||||
cloud-contract-maven-plugin:1.1.0.M1:convert failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at
|
||||
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) at
|
||||
...
|
||||
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: java.lang.NullPointerException at
|
||||
org.eclipse.m2e.core.internal.builder.plexusbuildapi.EclipseIncrementalBuildContext.hasDelta(EclipseIncrementalBuildContext.java:53) at
|
||||
org.sonatype.plexus.build.incremental.ThreadBuildContext.hasDelta(ThreadBuildContext.java:59) at</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>In order to fix this issue just provide the following section in your <code>pom.xml</code></p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-xml" data-lang="xml"><build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings
|
||||
only. It has no influence on the Maven build itself. -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
|
||||
<versionRange>[1.0,)</versionRange>
|
||||
<goals>
|
||||
<goal>convert</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<execute />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_spring_cloud_contract_verifier_on_consumer_side_2">Spring Cloud Contract Verifier on consumer side</h5>
|
||||
<div class="paragraph">
|
||||
<p>You can actually use the Spring Cloud Contract Verifier also for the consumer side!
|
||||
@@ -4888,6 +4920,19 @@ for every registered WireMock server. Example for Stub Runner ids
|
||||
<div class="paragraph">
|
||||
<p>Stub Runner can integrate with Spring Cloud.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>For real life examples you can check the</p>
|
||||
</div>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/master/producer">producer app sample</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/master/consumer_with_discovery">consumer app sample</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_stubbing_service_discovery">Stubbing Service Discovery</h4>
|
||||
<div class="paragraph">
|
||||
@@ -4939,6 +4984,27 @@ stubrunner:
|
||||
fraudDetectionServer: someNameThatShouldMapFraudDetectionServer</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="_test_profiles_and_service_discovery">Test profiles and service discovery</h5>
|
||||
<div class="paragraph">
|
||||
<p>In your integration tests you typically don’t want to call neither a discovery service (e.g. Eureka)
|
||||
or Config Server. That’s why you create an additional test configuration in which you want to disable
|
||||
these features.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Due to certain limitations of <a href="https://github.com/spring-cloud/spring-cloud-commons/issues/156"><code>spring-cloud-commons</code></a> to achieve this you have disable these properties
|
||||
via a static block like presented below (example for Eureka)</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-java" data-lang="java"> //Hack to work around https://github.com/spring-cloud/spring-cloud-commons/issues/156
|
||||
static {
|
||||
System.setProperty("eureka.client.enabled", "false");
|
||||
System.setProperty("spring.cloud.config.failFast", "false");
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_additional_configuration">Additional Configuration</h4>
|
||||
|
||||
Reference in New Issue
Block a user