Merge branch 'master' into 2.0.x
This commit is contained in:
@@ -6,7 +6,108 @@ In the following document we will write about necessary migration steps between
|
||||
|
||||
=== 1.0.x -> 1.1.x
|
||||
|
||||
TODO: https://github.com/spring-cloud/spring-cloud-contract/issues/350
|
||||
==== New structure of generated stubs
|
||||
|
||||
In `1.1.x` we have introduced a changed structure of generated stubs. So if you've
|
||||
been using the following `@AutoConfigureWireMock` notation to use the stubs from classpath
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@AutoConfigureWireMock(stubs = "classpath:/customer-stubs/mappings", port = 8084)
|
||||
----
|
||||
|
||||
It will no longer work with the new stubs. You have to either change the location of stubs
|
||||
to : `classpath:.../META-INF/groupId/artifactId/version/mappings` as follows
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@AutoConfigureWireMock(stubs = "classpath:customer-stubs/META-INF/travel.components/customer-contract/1.0.2-SNAPSHOT/mappings/", port = 8084)
|
||||
----
|
||||
|
||||
Or migrate to the new classpath based `@AutoConfigureStubRunner`.
|
||||
|
||||
If however you don't want to do that and you want to remain with the old structure
|
||||
just set your plugin tasks accordingly. Example for the structure presented in the
|
||||
snippet above.
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
|
||||
.Maven
|
||||
----
|
||||
<!-- start of pom.xml -->
|
||||
|
||||
<properties>
|
||||
<!-- we don't want the verifier to do a jar for us -->
|
||||
<spring.cloud.contract.verifier.skip>true</spring.cloud.contract.verifier.skip>
|
||||
</properties>
|
||||
|
||||
<!-- ... -->
|
||||
|
||||
<!-- You need to set up the assembly plugin -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>stub</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<attach>true</attach>
|
||||
<descriptor>${basedir}/src/assembly/stub.xml</descriptor>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<!-- end of pom.xml -->
|
||||
|
||||
<!-- start of stub.xml-->
|
||||
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
|
||||
<id>stubs</id>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/snippets/stubs</directory>
|
||||
<outputDirectory>customer-stubs/mappings</outputDirectory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${basedir}/src/test/resources/contracts</directory>
|
||||
<outputDirectory>customer-stubs/contracts</outputDirectory>
|
||||
<includes>
|
||||
<include>**/*.groovy</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
||||
<!-- end of stub.xml-->
|
||||
----
|
||||
|
||||
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
|
||||
.Gradle
|
||||
----
|
||||
task copyStubs(type: Copy, dependsOn: 'generateWireMockClientStubs') {
|
||||
// Preserve directory structure from 1.0.X of spring-cloud-contract
|
||||
from "${project.buildDir}/resources/main/customer-stubs/META-INF/${project.group}/${project.name}/${project.version}"
|
||||
into "${project.buildDir}/resources/main/customer-stubs"
|
||||
}
|
||||
----
|
||||
|
||||
=== 1.1.x -> 1.2.x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user