Sync docs from master to gh-pages

This commit is contained in:
buildmaster
2018-07-27 07:25:55 +00:00
parent bdd03dfb67
commit c0dc488d81
5 changed files with 101 additions and 215 deletions

View File

@@ -1762,98 +1762,37 @@ we could create the structure when the rest contracts would be placed in a folde
contracts in the folder per topic.</simpara>
<section xml:id="_for_maven_project">
<title>For Maven Project</title>
<simpara>To make it possible to work on the producer side we could do the following things (all via Maven plugins):</simpara>
<itemizedlist>
<listitem>
<simpara>Add common repo dependency to your classpath:</simpara>
</listitem>
</itemizedlist>
<programlisting language="xml" linenumbering="unnumbered">&lt;dependency&gt;
&lt;groupId&gt;com.example&lt;/groupId&gt;
&lt;artifactId&gt;common-repo&lt;/artifactId&gt;
&lt;version&gt;${common-repo.version}&lt;/version&gt;
&lt;/dependency&gt;</programlisting>
<itemizedlist>
<listitem>
<simpara>Download the JAR with the contracts and unpack the JAR to target:</simpara>
</listitem>
</itemizedlist>
<programlisting language="xml" linenumbering="unnumbered">&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
&lt;version&gt;3.0.0&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;unpack-dependencies&lt;/id&gt;
&lt;phase&gt;process-resources&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;unpack&lt;/goal&gt;
&lt;/goals&gt;
&lt;configuration&gt;
&lt;artifactItems&gt;
&lt;artifactItem&gt;
&lt;groupId&gt;com.example&lt;/groupId&gt;
&lt;artifactId&gt;common-repo&lt;/artifactId&gt;
&lt;type&gt;jar&lt;/type&gt;
&lt;overWrite&gt;false&lt;/overWrite&gt;
&lt;outputDirectory&gt;${project.build.directory}/contracts&lt;/outputDirectory&gt;
&lt;/artifactItem&gt;
&lt;/artifactItems&gt;
&lt;/configuration&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;</programlisting>
<itemizedlist>
<listitem>
<simpara>Rip out all the folders we&#8217;re not interested in:</simpara>
</listitem>
</itemizedlist>
<programlisting language="xml" linenumbering="unnumbered">&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
&lt;version&gt;1.8&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;phase&gt;process-resources&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;run&lt;/goal&gt;
&lt;/goals&gt;
&lt;configuration&gt;
&lt;tasks&gt;
&lt;delete includeemptydirs="true"&gt;
&lt;fileset dir="${project.build.directory}/contracts"&gt;
&lt;include name="**/*" /&gt;
&lt;!--Producer artifactId--&gt;
&lt;exclude name="**/${project.artifactId}/**" /&gt;
&lt;!--List of the supported topics--&gt;
&lt;exclude name="**/${first-topic}/**" /&gt;
&lt;exclude name="**/${second-topic}/**" /&gt;
&lt;/fileset&gt;
&lt;/delete&gt;
&lt;/tasks&gt;
&lt;/configuration&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;</programlisting>
<itemizedlist>
<listitem>
<simpara>Run the contract plugin by pointing to the contracts to the folder under target:</simpara>
</listitem>
</itemizedlist>
<simpara>To make it possible to work on the producer side we should specify an inclusion pattern for
filtering common repository jar by messaging topics we are interested in. <literal><literal>includedFiles</literal></literal> property of <literal><literal>Maven Spring Cloud Contract plugin</literal></literal>
allows us to do that. Also <literal><literal>contractsPath</literal></literal> need to be specified since the default path would be the common repository <literal><literal>groupid/artifactid</literal></literal>.</simpara>
<programlisting language="xml" linenumbering="unnumbered">&lt;plugin&gt;
&lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
&lt;artifactId&gt;spring-cloud-contract-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${spring-cloud-contract.version}&lt;/version&gt;
&lt;extensions&gt;true&lt;/extensions&gt;
&lt;configuration&gt;
&lt;packageWithBaseClasses&gt;com.example&lt;/packageWithBaseClasses&gt;
&lt;contractsMode&gt;REMOTE&lt;/contractsMode&gt;
&lt;contractsRepositoryUrl&gt;http://link/to/your/nexus/or/artifactory/or/sth&lt;/contractsRepositoryUrl&gt;
&lt;contractDependency&gt;
&lt;groupId&gt;com.example&lt;/groupId&gt;
&lt;artifactId&gt;common-repo-with-contracts&lt;/artifactId&gt;
&lt;version&gt;+&lt;/version&gt;
&lt;/contractDependency&gt;
&lt;contractsPath&gt;/&lt;/contractsPath&gt;
&lt;baseClassMappings&gt;
&lt;baseClassMapping&gt;
&lt;contractPackageRegex&gt;.*intoxication.*&lt;/contractPackageRegex&gt;
&lt;baseClassFQN&gt;com.example.intoxication.BeerIntoxicationBase&lt;/baseClassFQN&gt;
&lt;contractPackageRegex&gt;.*messaging.*&lt;/contractPackageRegex&gt;
&lt;baseClassFQN&gt;com.example.services.MessagingBase&lt;/baseClassFQN&gt;
&lt;/baseClassMapping&gt;
&lt;baseClassMapping&gt;
&lt;contractPackageRegex&gt;.*rest.*&lt;/contractPackageRegex&gt;
&lt;baseClassFQN&gt;com.example.services.TestBase&lt;/baseClassFQN&gt;
&lt;/baseClassMapping&gt;
&lt;/baseClassMappings&gt;
&lt;contractsDirectory&gt;${project.build.directory}/contracts&lt;/contractsDirectory&gt;
&lt;includedFiles&gt;
&lt;includedFile&gt;**/${project.artifactId}/**&lt;/includedFile&gt;
&lt;includedFile&gt;**/${first-topic}/**&lt;/includedFile&gt;
&lt;includedFile&gt;**/${second-topic}/**&lt;/includedFile&gt;
&lt;/includedFiles&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;</programlisting>
</section>