Skip to content

Commit d44ecf5

Browse files
Merge branch '2.3.x'
Closes gh-23731
2 parents d005a64 + 9c672de commit d44ecf5

File tree

7 files changed

+110
-43
lines changed

7 files changed

+110
-43
lines changed

buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/DocumentPluginGoals.java

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,7 @@ private void writeParametersTable(PrintWriter writer, String detailsSectionId, L
136136
for (Parameter parameter : parameters) {
137137
String name = parameter.getName();
138138
writer.printf("| <<%s-%s,%s>>%n", detailsSectionId, name, name);
139-
String type = parameter.getType();
140-
if (type.lastIndexOf('.') >= 0) {
141-
type = type.substring(type.lastIndexOf('.') + 1);
142-
}
143-
writer.printf("| `%s`%n", type);
139+
writer.printf("| `%s`%n", typeNameToJavadocLink(shortTypeName(parameter.getType()), parameter.getType()));
144140
String defaultValue = parameter.getDefaultValue();
145141
if (defaultValue != null) {
146142
writer.printf("| `%s`%n", defaultValue);
@@ -166,7 +162,7 @@ private void writeParameterDetails(PrintWriter writer, List<Parameter> parameter
166162
writer.println("|===");
167163
writer.println();
168164
writeDetail(writer, "Name", name);
169-
writeDetail(writer, "Type", parameter.getType());
165+
writeDetail(writer, "Type", typeNameToJavadocLink(parameter.getType()));
170166
writeOptionalDetail(writer, "Default value", parameter.getDefaultValue());
171167
writeOptionalDetail(writer, "User property", parameter.getUserProperty());
172168
writeOptionalDetail(writer, "Since", parameter.getSince());
@@ -191,4 +187,32 @@ private void writeOptionalDetail(PrintWriter writer, String name, String value)
191187
writer.println();
192188
}
193189

190+
private String shortTypeName(String name) {
191+
if (name.lastIndexOf('.') >= 0) {
192+
name = name.substring(name.lastIndexOf('.') + 1);
193+
}
194+
if (name.lastIndexOf('$') >= 0) {
195+
name = name.substring(name.lastIndexOf('$') + 1);
196+
}
197+
return name;
198+
}
199+
200+
private String typeNameToJavadocLink(String name) {
201+
return typeNameToJavadocLink(name, name);
202+
}
203+
204+
private String typeNameToJavadocLink(String shortName, String name) {
205+
if (name.startsWith("org.springframework.boot.maven")) {
206+
return "{spring-boot-docs}/maven-plugin/api/" + typeNameToJavadocPath(name) + ".html[" + shortName + "]";
207+
}
208+
if (name.startsWith("org.springframework.boot")) {
209+
return "{spring-boot-docs}/api/" + typeNameToJavadocPath(name) + ".html[" + shortName + "]";
210+
}
211+
return shortName;
212+
}
213+
214+
private String typeNameToJavadocPath(String name) {
215+
return name.replace(".", "/").replace("$", ".");
216+
}
217+
194218
}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
4040

4141
/**
4242
* Collection of artifact definitions to include. The {@link Include} element defines
43-
* a {@code groupId} and {@code artifactId} mandatory properties and an optional
43+
* mandatory {@code groupId} and {@code artifactId} properties and an optional
44+
* mandatory {@code groupId} and {@code artifactId} properties and an optional
4445
* {@code classifier} property.
4546
* @since 1.2.0
4647
*/
@@ -49,7 +50,7 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
4950

5051
/**
5152
* Collection of artifact definitions to exclude. The {@link Exclude} element defines
52-
* a {@code groupId} and {@code artifactId} mandatory properties and an optional
53+
* mandatory {@code groupId} and {@code artifactId} properties and an optional
5354
* {@code classifier} property.
5455
* @since 1.1.0
5556
*/

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
7575

7676
/**
7777
* The name of the main class. If not specified the first compiled class found that
78-
* contains a 'main' method will be used.
78+
* contains a {@code main} method will be used.
7979
* @since 1.0.0
8080
*/
8181
@Parameter
8282
private String mainClass;
8383

8484
/**
8585
* The type of archive (which corresponds to how the dependencies are laid out inside
86-
* it). Possible values are JAR, WAR, ZIP, DIR, NONE. Defaults to a guess based on the
87-
* archive type.
86+
* it). Possible values are {@code JAR}, {@code WAR}, {@code ZIP}, {@code DIR},
87+
* {@code NONE}. Defaults to a guess based on the archive type.
8888
* @since 1.0.0
8989
*/
9090
@Parameter(property = "spring-boot.repackage.layout")
@@ -114,7 +114,8 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
114114
public boolean includeSystemScope;
115115

116116
/**
117-
* Layer configuration with the option to exclude layer tools jar.
117+
* Layer configuration with options to disable layer creation, exclude layer tools
118+
* jar, and provide a custom layers configuration file.
118119
* @since 2.3.0
119120
*/
120121
@Parameter
@@ -211,7 +212,7 @@ public enum LayoutType {
211212
ZIP(new Expanded()),
212213

213214
/**
214-
* Dir Layout.
215+
* Directory Layout.
215216
*/
216217
DIR(new Expanded()),
217218

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ public class BuildImageMojo extends AbstractPackagerMojo {
100100
private String classifier;
101101

102102
/**
103-
* Image configuration, with `builder`, `runImage`, `name`, `env`, `cleanCache`,
104-
* `verboseLogging`, and `publish` options.
103+
* Image configuration, with {@code builder}, {@code runImage}, {@code name},
104+
* {@code env}, {@code cleanCache}, {@code verboseLogging}, {@code pullPolicy}, and
105+
* {@code publish} options.
105106
* @since 2.3.0
106107
*/
107108
@Parameter

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class BuildInfoMojo extends AbstractMojo {
6262
private MavenProject project;
6363

6464
/**
65-
* The location of the generated build-info.properties.
65+
* The location of the generated {@code build-info.properties} file.
6666
*/
6767
@Parameter(defaultValue = "${project.build.outputDirectory}/META-INF/build-info.properties")
6868
private File outputFile;
@@ -77,8 +77,8 @@ public class BuildInfoMojo extends AbstractMojo {
7777
private String time;
7878

7979
/**
80-
* Additional properties to store in the build-info.properties. Each entry is prefixed
81-
* by {@code build.} in the generated build-info.properties.
80+
* Additional properties to store in the {@code build-info.properties} file. Each
81+
* entry is prefixed by {@code build.} in the generated {@code build-info.properties}.
8282
*/
8383
@Parameter
8484
private Map<String, String> additionalProperties;

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/Image.java

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,62 +38,102 @@
3838
*/
3939
public class Image {
4040

41-
/**
42-
* The name of the created image.
43-
*/
4441
String name;
4542

46-
/**
47-
* The builder used to create the image.
48-
*/
4943
String builder;
5044

51-
/**
52-
* The run image used to launch the built image.
53-
*/
5445
String runImage;
5546

56-
/**
57-
* Environment properties that should be passed to the builder.
58-
*/
5947
Map<String, String> env;
6048

61-
/**
62-
* If the cache should be cleaned before building.
63-
*/
6449
boolean cleanCache;
6550

66-
/**
67-
* If verbose logging is required.
68-
*/
6951
boolean verboseLogging;
7052

71-
/**
72-
* If images should be pulled from a remote repository during image build.
73-
*/
7453
PullPolicy pullPolicy;
7554

55+
Boolean publish;
56+
7657
/**
77-
* If the built image should be pushed to a registry.
58+
* The name of the created image.
59+
* @return the image name
7860
*/
79-
Boolean publish;
61+
public String getName() {
62+
return this.name;
63+
}
8064

8165
void setName(String name) {
8266
this.name = name;
8367
}
8468

69+
/**
70+
* The name of the builder image to use to create the image.
71+
* @return the builder image name
72+
*/
73+
public String getBuilder() {
74+
return this.builder;
75+
}
76+
8577
void setBuilder(String builder) {
8678
this.builder = builder;
8779
}
8880

81+
/**
82+
* The name of the run image to use to create the image.
83+
* @return the builder image name
84+
*/
85+
public String getRunImage() {
86+
return this.runImage;
87+
}
88+
8989
void setRunImage(String runImage) {
9090
this.runImage = runImage;
9191
}
9292

93+
/**
94+
* Environment properties that should be passed to the builder.
95+
* @return the environment properties
96+
*/
97+
public Map<String, String> getEnv() {
98+
return this.env;
99+
}
100+
101+
/**
102+
* If the cache should be cleaned before building.
103+
* @return {@code true} if the cache should be cleaned
104+
*/
105+
public boolean isCleanCache() {
106+
return this.cleanCache;
107+
}
108+
109+
/**
110+
* If verbose logging is required.
111+
* @return {@code true} for verbose logging
112+
*/
113+
public boolean isVerboseLogging() {
114+
return this.verboseLogging;
115+
}
116+
117+
/**
118+
* If images should be pulled from a remote repository during image build.
119+
* @return the pull policy
120+
*/
121+
public PullPolicy getPullPolicy() {
122+
return this.pullPolicy;
123+
}
124+
93125
public void setPullPolicy(PullPolicy pullPolicy) {
94126
this.pullPolicy = pullPolicy;
95127
}
96128

129+
/**
130+
* If the built image should be pushed to a registry.
131+
* @return {@code true} if the image should be published
132+
*/
133+
public Boolean getPublish() {
134+
return this.publish;
135+
}
136+
97137
public void setPublish(Boolean publish) {
98138
this.publish = publish;
99139
}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/Layers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public class Layers {
3333
private File configuration;
3434

3535
/**
36-
* Whether a layers.idx file should be added to the jar.
37-
* @return true if a layers.idx file should be added.
36+
* Whether a {@code layers.idx} file should be added to the jar.
37+
* @return true if a {@code layers.idx} file should be added.
3838
*/
3939
public boolean isEnabled() {
4040
return this.enabled;

0 commit comments

Comments
 (0)