Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 2072a73

Browse files
authored
properly generated javadoc jar in all modules (#81)
* properly generated javadoc jar in all modules * build should run through all phases
1 parent 952ffd0 commit 2072a73

File tree

10 files changed

+138
-62
lines changed

10 files changed

+138
-62
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before_install:
1616
-DgroupId=org.springframework.restdocs -DartifactId=spring-restdocs-core -Dversion=1.1.2.RELEASE
1717
-Dpackaging=jar -Dclassifier=test
1818
script:
19-
- mvn test -B
19+
- mvn install -B -V
2020
- cd spring-auto-restdocs-example
2121
- ./gradlew check
2222
- cd ..

docs/index.html

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -602,24 +602,25 @@ <h3 id="gettingstarted-usage"><a class="link" href="#gettingstarted-usage">Usage
602602
&lt;extensions&gt;true&lt;/extensions&gt;
603603
&lt;executions&gt;
604604
&lt;execution&gt;
605+
&lt;id&gt;generate-javadoc-json&lt;/id&gt;
605606
&lt;phase&gt;compile&lt;/phase&gt;
606607
&lt;goals&gt;
607608
&lt;goal&gt;javadoc-no-fork&lt;/goal&gt;
608609
&lt;/goals&gt;
610+
&lt;configuration&gt;
611+
&lt;doclet&gt;capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet&lt;/doclet&gt;
612+
&lt;docletArtifact&gt;
613+
&lt;groupId&gt;capital.scalable&lt;/groupId&gt;
614+
&lt;artifactId&gt;spring-auto-restdocs-json-doclet&lt;/artifactId&gt;
615+
&lt;version&gt;1.0.6&lt;/version&gt;
616+
&lt;/docletArtifact&gt;
617+
&lt;destDir&gt;generated-javadoc-json&lt;/destDir&gt;
618+
&lt;reportOutputDirectory&gt;${project.build.directory}&lt;/reportOutputDirectory&gt;
619+
&lt;useStandardDocletOptions&gt;false&lt;/useStandardDocletOptions&gt;
620+
&lt;show&gt;package&lt;/show&gt;
621+
&lt;/configuration&gt;
609622
&lt;/execution&gt;
610623
&lt;/executions&gt;
611-
&lt;configuration&gt;
612-
&lt;doclet&gt;capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet&lt;/doclet&gt;
613-
&lt;docletArtifact&gt;
614-
&lt;groupId&gt;capital.scalable&lt;/groupId&gt;
615-
&lt;artifactId&gt;spring-auto-restdocs-json-doclet&lt;/artifactId&gt;
616-
&lt;version&gt;1.0.6&lt;/version&gt;
617-
&lt;/docletArtifact&gt;
618-
&lt;destDir&gt;generated-javadoc-json&lt;/destDir&gt;
619-
&lt;reportOutputDirectory&gt;${project.build.directory}&lt;/reportOutputDirectory&gt;
620-
&lt;useStandardDocletOptions&gt;false&lt;/useStandardDocletOptions&gt;
621-
&lt;show&gt;package&lt;/show&gt;
622-
&lt;/configuration&gt;
623624
&lt;/plugin&gt;
624625
...
625626
&lt;/plugins&gt;
@@ -1498,7 +1499,7 @@ <h4 id="contributing-building-build"><a class="link" href="#contributing-buildin
14981499
</div>
14991500
<div id="footer">
15001501
<div id="footer-text">
1501-
Last updated 2017-03-01 19:17:18 CET
1502+
Last updated 2017-03-02 09:48:15 CET
15021503
</div>
15031504
</div>
15041505
<link rel="stylesheet" href="highlight/styles/github.min.css">

spring-auto-restdocs-core/pom.xml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,25 @@
123123
<extensions>true</extensions>
124124
<executions>
125125
<execution>
126+
<id>generate-javadoc-json</id>
126127
<phase>compile</phase>
127128
<goals>
128129
<goal>test-javadoc-no-fork</goal>
129130
</goals>
131+
<configuration>
132+
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
133+
<docletArtifact>
134+
<groupId>capital.scalable</groupId>
135+
<artifactId>spring-auto-restdocs-json-doclet</artifactId>
136+
<version>${project.parent.version}</version>
137+
</docletArtifact>
138+
<destDir>generated-javadoc-json</destDir>
139+
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
140+
<useStandardDocletOptions>false</useStandardDocletOptions>
141+
<show>package</show>
142+
</configuration>
130143
</execution>
131144
</executions>
132-
<configuration>
133-
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
134-
<docletArtifact>
135-
<groupId>capital.scalable</groupId>
136-
<artifactId>spring-auto-restdocs-json-doclet</artifactId>
137-
<version>${project.parent.version}</version>
138-
</docletArtifact>
139-
<destDir>generated-javadoc-json</destDir>
140-
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
141-
<useStandardDocletOptions>false</useStandardDocletOptions>
142-
<show>package</show>
143-
</configuration>
144145
</plugin>
145146
</plugins>
146147
</build>

spring-auto-restdocs-core/src/main/java/capital/scalable/restdocs/response/ResponseModifyingPreprocessors.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public class ResponseModifyingPreprocessors {
2828
* Only modifies the content of a response.
2929
* <p>
3030
* Contains {@link #replaceBinaryContent()}, {@link #limitJsonArrayLength(ObjectMapper)}
31+
*
32+
* @param objectMapper object mapper instance
33+
* @return a response shortening preprocessor
3134
*/
3235
public static OperationResponsePreprocessor shortenContent(ObjectMapper objectMapper) {
3336
return Preprocessors.preprocessResponse(replaceBinaryContent(),
@@ -36,13 +39,18 @@ public static OperationResponsePreprocessor shortenContent(ObjectMapper objectMa
3639

3740
/**
3841
* For binary content, replaces value with "&lt;binary&gt;".
42+
*
43+
* @return a preprocessor replacing binary content
3944
*/
4045
public static OperationPreprocessor replaceBinaryContent() {
4146
return new ContentModifyingOperationPreprocessor(new BinaryReplacementContentModifier());
4247
}
4348

4449
/**
4550
* For JSON content, cuts the length of all JSON arrays in the response to 3 elements.
51+
*
52+
* @param objectMapper object mapper to use
53+
* @return an array limiting preprocessor
4654
*/
4755
public static OperationPreprocessor limitJsonArrayLength(ObjectMapper objectMapper) {
4856
return new ContentModifyingOperationPreprocessor(

spring-auto-restdocs-core/src/main/java/capital/scalable/restdocs/section/SectionBuilder.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
import capital.scalable.restdocs.SnippetRegistry;
2424

25+
/**
26+
* Builder for configuring a section snippet.
27+
*/
2528
public class SectionBuilder {
2629

2730
public static final Collection<String> DEFAULT_SNIPPETS = Arrays.asList(
@@ -45,6 +48,7 @@ public SectionBuilder() {
4548
*
4649
* @param snippetNames snippet names to use; if not specified, {@link #DEFAULT_SNIPPETS} will
4750
* be used
51+
* @return this
4852
*/
4953
public SectionBuilder snippetNames(List<String> snippetNames) {
5054
this.snippetNames = snippetNames;
@@ -56,9 +60,10 @@ public SectionBuilder snippetNames(List<String> snippetNames) {
5660
*
5761
* @param snippetNames snippet names to use; if not specified, {@link #DEFAULT_SNIPPETS} will
5862
* be used
63+
* @return this
5964
*/
60-
public SectionBuilder snippetNames(String... sectionNames) {
61-
this.snippetNames = Arrays.asList(sectionNames);
65+
public SectionBuilder snippetNames(String... snippetNames) {
66+
this.snippetNames = Arrays.asList(snippetNames);
6267
return this;
6368
}
6469

@@ -68,6 +73,7 @@ public SectionBuilder snippetNames(String... sectionNames) {
6873
*
6974
* @param skipEmpty true if snippets with no content should not be included in the section;
7075
* false otherwise (default)
76+
* @return this
7177
*/
7278
public SectionBuilder skipEmpty(boolean skipEmpty) {
7379
this.skipEmpty = skipEmpty;

spring-auto-restdocs-core/src/main/java/capital/scalable/restdocs/section/SectionSupport.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,23 @@
2121
public interface SectionSupport {
2222
/**
2323
* File name (= section name).
24+
*
25+
* @return file name
2426
*/
2527
String getFileName();
2628

2729
/**
2830
* Section header.
31+
*
32+
* @return header
2933
*/
3034
String getHeader();
3135

3236
/**
3337
* Flag if section will render non-empty content.
38+
*
39+
* @param operation operation
40+
* @return true if snippet will return non-empty content; false otherwise
3441
*/
3542
boolean hasContent(Operation operation);
3643
}

spring-auto-restdocs-docs/getting-started.adoc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,25 @@ Spring Auto REST Docs has the following minimum requirements:
5050
<extensions>true</extensions>
5151
<executions>
5252
<execution>
53+
<id>generate-javadoc-json</id>
5354
<phase>compile</phase>
5455
<goals>
5556
<goal>javadoc-no-fork</goal>
5657
</goals>
58+
<configuration>
59+
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
60+
<docletArtifact>
61+
<groupId>capital.scalable</groupId>
62+
<artifactId>spring-auto-restdocs-json-doclet</artifactId>
63+
<version>${latestRelease}</version>
64+
</docletArtifact>
65+
<destDir>generated-javadoc-json</destDir>
66+
<reportOutputDirectory>\${project.build.directory}</reportOutputDirectory>
67+
<useStandardDocletOptions>false</useStandardDocletOptions>
68+
<show>package</show>
69+
</configuration>
5770
</execution>
5871
</executions>
59-
<configuration>
60-
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
61-
<docletArtifact>
62-
<groupId>capital.scalable</groupId>
63-
<artifactId>spring-auto-restdocs-json-doclet</artifactId>
64-
<version>${latestRelease}</version>
65-
</docletArtifact>
66-
<destDir>generated-javadoc-json</destDir>
67-
<reportOutputDirectory>\${project.build.directory}</reportOutputDirectory>
68-
<useStandardDocletOptions>false</useStandardDocletOptions>
69-
<show>package</show>
70-
</configuration>
7172
</plugin>
7273
...
7374
</plugins>

spring-auto-restdocs-example/generated-docs/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ <h4 id="_response_fields_3"><a class="anchor" href="#_response_fields_3"></a>2.3
10361036
<h4 id="_example_request"><a class="anchor" href="#_example_request"></a>2.3.6. Example request</h4>
10371037
<div class="listingblock">
10381038
<div class="content">
1039-
<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/items' -i -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer cea8f330-458f-4c41-a94d-35b5513bd588' -d '{"description":"Hot News"}'</code></pre>
1039+
<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/items' -i -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer cd682a43-bb11-459e-b986-4b1cf15c4e5b' -d '{"description":"Hot News"}'</code></pre>
10401040
</div>
10411041
</div>
10421042
</div>
@@ -1247,7 +1247,7 @@ <h4 id="_response_fields_4"><a class="anchor" href="#_response_fields_4"></a>2.4
12471247
<h4 id="_example_request_2"><a class="anchor" href="#_example_request_2"></a>2.4.6. Example request</h4>
12481248
<div class="listingblock">
12491249
<div class="content">
1250-
<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/items/1' -i -X PUT -H 'Content-Type: application/json' -H 'Authorization: Bearer cea8f330-458f-4c41-a94d-35b5513bd588' -d '{"description":"Hot News"}'</code></pre>
1250+
<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/items/1' -i -X PUT -H 'Content-Type: application/json' -H 'Authorization: Bearer cd682a43-bb11-459e-b986-4b1cf15c4e5b' -d '{"description":"Hot News"}'</code></pre>
12511251
</div>
12521252
</div>
12531253
</div>
@@ -1314,7 +1314,8 @@ <h4 id="_path_parameters_4"><a class="anchor" href="#_path_parameters_4"></a>2.5
13141314
<td class="tableblock halign-left valign-top"><p class="tableblock">id</p></td>
13151315
<td class="tableblock halign-left valign-top"><p class="tableblock">String</p></td>
13161316
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
1317-
<td class="tableblock halign-left valign-top"><p class="tableblock">Must be a valid ID.</p></td>
1317+
<td class="tableblock halign-left valign-top"><p class="tableblock">item ID.<br>
1318+
Must be a valid ID.</p></td>
13181319
</tr>
13191320
</tbody>
13201321
</table>
@@ -1341,7 +1342,7 @@ <h4 id="_response_fields_5"><a class="anchor" href="#_response_fields_5"></a>2.5
13411342
<h4 id="_example_request_3"><a class="anchor" href="#_example_request_3"></a>2.5.6. Example request</h4>
13421343
<div class="listingblock">
13431344
<div class="content">
1344-
<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/items/1' -i -X DELETE -H 'Authorization: Bearer cea8f330-458f-4c41-a94d-35b5513bd588'</code></pre>
1345+
<pre class="highlightjs highlight"><code class="language-bash" data-lang="bash">$ curl 'http://localhost:8080/items/1' -i -X DELETE -H 'Authorization: Bearer cd682a43-bb11-459e-b986-4b1cf15c4e5b'</code></pre>
13451346
</div>
13461347
</div>
13471348
</div>
@@ -1762,8 +1763,8 @@ <h4 id="_example_response_5"><a class="anchor" href="#_example_response_5"></a>2
17621763
} ],
17631764
"pageable" : null,
17641765
"total" : 1,
1765-
"last" : true,
17661766
"totalPages" : 1,
1767+
"last" : true,
17671768
"totalElements" : 1,
17681769
"size" : 0,
17691770
"number" : 0,

spring-auto-restdocs-example/pom.xml

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<groupId>capital.scalable</groupId>
1515
<artifactId>spring-auto-restdocs-example</artifactId>
16-
<version>1.0.6</version> <!-- not related to actual project version -->
16+
<version>1.0.6</version> <!-- not related to spring-auto-restdocs version -->
1717

1818
<name>Spring Auto REST Docs Example Project</name>
1919
<description>Example project for Spring Auto REST Docs</description>
@@ -158,33 +158,79 @@
158158
</execution>
159159
</executions>
160160
</plugin>
161+
<plugin>
162+
<groupId>org.apache.maven.plugins</groupId>
163+
<artifactId>maven-source-plugin</artifactId>
164+
<executions>
165+
<execution>
166+
<id>attach-sources</id>
167+
<goals>
168+
<goal>jar-no-fork</goal>
169+
</goals>
170+
</execution>
171+
</executions>
172+
</plugin>
161173
<plugin>
162174
<artifactId>maven-javadoc-plugin</artifactId>
163175
<extensions>true</extensions>
164176
<executions>
165177
<execution>
178+
<id>attach-javadocs</id>
179+
<goals>
180+
<goal>jar</goal>
181+
</goals>
182+
</execution>
183+
<execution>
184+
<id>generate-javadoc-json</id>
166185
<phase>compile</phase>
167186
<goals>
168187
<goal>javadoc-no-fork</goal>
169188
</goals>
189+
<configuration>
190+
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
191+
<docletArtifact>
192+
<groupId>capital.scalable</groupId>
193+
<artifactId>spring-auto-restdocs-json-doclet</artifactId>
194+
<version>${spring-auto-restdocs.version}</version>
195+
</docletArtifact>
196+
<destDir>generated-javadoc-json</destDir>
197+
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
198+
<useStandardDocletOptions>false</useStandardDocletOptions>
199+
<show>package</show>
200+
</configuration>
170201
</execution>
171202
</executions>
172-
<configuration>
173-
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
174-
<docletArtifact>
175-
<groupId>capital.scalable</groupId>
176-
<artifactId>spring-auto-restdocs-json-doclet</artifactId>
177-
<version>${spring-auto-restdocs.version}</version>
178-
</docletArtifact>
179-
<destDir>generated-javadoc-json</destDir>
180-
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
181-
<useStandardDocletOptions>false</useStandardDocletOptions>
182-
<show>package</show>
183-
</configuration>
184203
</plugin>
185204
</plugins>
186205
</build>
187206

207+
<profiles>
208+
<profile>
209+
<id>sign-artifacts</id>
210+
<activation>
211+
<property>
212+
<name>gpg.passphrase</name>
213+
</property>
214+
</activation>
215+
<build>
216+
<plugins>
217+
<plugin>
218+
<artifactId>maven-gpg-plugin</artifactId>
219+
<executions>
220+
<execution>
221+
<id>sign-artifacts</id>
222+
<phase>verify</phase>
223+
<goals>
224+
<goal>sign</goal>
225+
</goals>
226+
</execution>
227+
</executions>
228+
</plugin>
229+
</plugins>
230+
</build>
231+
</profile>
232+
</profiles>
233+
188234
<distributionManagement>
189235
<snapshotRepository>
190236
<id>ossrh</id>

0 commit comments

Comments
 (0)