Skip to content

Commit 3f9f0e4

Browse files
authored
[MCOMPILER-570] Add links to javac documentation of JDK17 (#224)
Cleanup of javadoc
1 parent 528d79d commit 3f9f0e4

File tree

3 files changed

+45
-14
lines changed

3 files changed

+45
-14
lines changed

src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java

+33-9
Original file line numberDiff line numberDiff line change
@@ -138,26 +138,32 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
138138

139139
/**
140140
* Set to <code>true</code> to include debugging information in the compiled class files.
141+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-g">javac -g</a>
142+
* @see #debuglevel
141143
*/
142144
@Parameter(property = "maven.compiler.debug", defaultValue = "true")
143145
private boolean debug = true;
144146

145147
/**
146148
* Set to <code>true</code> to generate metadata for reflection on method parameters.
147149
* @since 3.6.2
150+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-parameters">javac -parameters</a>
148151
*/
149152
@Parameter(property = "maven.compiler.parameters", defaultValue = "false")
150153
private boolean parameters;
151154

152155
/**
153-
* Set to <code>true</code> to Enable preview language features of the java compiler
156+
* Set to <code>true</code> to enable preview language features of the java compiler
154157
* @since 3.10.1
158+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-enable-preview">javac --enable-preview</a>
155159
*/
156160
@Parameter(property = "maven.compiler.enablePreview", defaultValue = "false")
157161
private boolean enablePreview;
158162

159163
/**
160164
* Set to <code>true</code> to show messages about what the compiler is doing.
165+
*
166+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-verbose">javac -verbose</a>
161167
*/
162168
@Parameter(property = "maven.compiler.verbose", defaultValue = "false")
163169
private boolean verbose;
@@ -183,39 +189,44 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
183189
private boolean showWarnings;
184190

185191
/**
186-
* <p>The -source argument for the Java compiler.</p>
192+
* <p>The {@code -source} argument for the Java compiler.</p>
187193
*
188194
* <p><b>NOTE: </b></p>
189195
* <p>Since 3.8.0 the default value has changed from 1.5 to 1.6</p>
190196
* <p>Since 3.9.0 the default value has changed from 1.6 to 1.7</p>
191197
* <p>Since 3.11.0 the default value has changed from 1.7 to 1.8</p>
198+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-source">javac -source</a>
192199
*/
193200
@Parameter(property = "maven.compiler.source", defaultValue = DEFAULT_SOURCE)
194201
protected String source;
195202

196203
/**
197-
* <p>The -target argument for the Java compiler.</p>
204+
* <p>The {@code -target} argument for the Java compiler.</p>
198205
*
199206
* <p><b>NOTE: </b></p>
200207
* <p>Since 3.8.0 the default value has changed from 1.5 to 1.6</p>
201208
* <p>Since 3.9.0 the default value has changed from 1.6 to 1.7</p>
202209
* <p>Since 3.11.0 the default value has changed from 1.7 to 1.8</p>
210+
*
211+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-target">javac -target</a>
203212
*/
204213
@Parameter(property = "maven.compiler.target", defaultValue = DEFAULT_TARGET)
205214
protected String target;
206215

207216
/**
208-
* The -release argument for the Java compiler, supported since Java9
217+
* The {@code -release} argument for the Java compiler, supported since Java9
209218
*
210219
* @since 3.6
220+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-release">javac -release</a>
211221
*/
212222
@Parameter(property = "maven.compiler.release")
213223
protected String release;
214224

215225
/**
216-
* The -encoding argument for the Java compiler.
226+
* The {@code -encoding} argument for the Java compiler.
217227
*
218228
* @since 2.1
229+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-encoding">javac -encoding</a>
219230
*/
220231
@Parameter(property = "encoding", defaultValue = "${project.build.sourceEncoding}")
221232
private String encoding;
@@ -286,6 +297,8 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
286297
* </ul>
287298
*
288299
* @since 2.2
300+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-proc">javac -proc</a>
301+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#annotation-processing">javac Annotation Processing</a>
289302
*/
290303
@Parameter
291304
private String proc;
@@ -297,6 +310,8 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
297310
* </p>
298311
*
299312
* @since 2.2
313+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-processor">javac -processor</a>
314+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#annotation-processing">javac Annotation Processing</a>
300315
*/
301316
@Parameter
302317
private String[] annotationProcessors;
@@ -335,6 +350,9 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
335350
* <b>Note:</b> Exclusions are supported from version 3.11.0.
336351
*
337352
* @since 3.5
353+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-processor-path">javac -processorpath</a>
354+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#annotation-processing">javac Annotation Processing</a>
355+
*
338356
*/
339357
@Parameter
340358
private List<DependencyCoordinate> annotationProcessorPaths;
@@ -346,7 +364,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
346364
* </p>
347365
* <p>
348366
* This flag does not enable / disable the ability to resolve the version of annotation processor paths
349-
* from dependency management section. It only influences the resolution o transitive dependencies of those
367+
* from dependency management section. It only influences the resolution of transitive dependencies of those
350368
* top-level paths.
351369
* </p>
352370
*
@@ -403,6 +421,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
403421
* </pre>
404422
*
405423
* @since 3.1
424+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-J">javac -J</a>
406425
*/
407426
@Parameter
408427
protected List<String> compilerArgs;
@@ -418,6 +437,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
418437
* <p>
419438
* Note that {@code -J} options are only passed through if {@link #fork} is set to {@code true}.
420439
* </p>
440+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-J">javac -J</a>
421441
*/
422442
@Parameter
423443
protected String compilerArgument;
@@ -435,9 +455,10 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
435455
* Keyword list to be appended to the <code>-g</code> command-line switch. Legal values are none or a
436456
* comma-separated list of the following keywords: <code>lines</code>, <code>vars</code>, and <code>source</code>.
437457
* If debug level is not specified, by default, nothing will be appended to <code>-g</code>.
438-
* If debug is not turned on, this attribute will be ignored.
458+
* If {@link #debug} is not turned on, this attribute will be ignored.
439459
*
440460
* @since 2.1
461+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-g-custom">javac -G:[lines,vars,source]</a>
441462
*/
442463
@Parameter(property = "maven.compiler.debuglevel")
443464
private String debuglevel;
@@ -446,6 +467,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
446467
* Keyword to be appended to the <code>-implicit:</code> command-line switch.
447468
*
448469
* @since 3.10.2
470+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-implicit">javac -implicit</a>
449471
*/
450472
@Parameter(property = "maven.compiler.implicit")
451473
private String implicit;
@@ -546,8 +568,10 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
546568
private boolean skipMultiThreadWarning;
547569

548570
/**
549-
* compiler can now use javax.tools if available in your current jdk, you can disable this feature
550-
* using -Dmaven.compiler.forceJavacCompilerUse=true or in the plugin configuration
571+
* The underlying compiler now uses <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.compiler/javax/tools/package-summary.html">{@code javax.tools} API</a>
572+
* if available in your current JDK.
573+
* Set this to {@code true} to always use the legacy <a href="https://docs.oracle.com/en/java/javase/17/docs/api/jdk.compiler/com/sun/tools/javac/package-summary.html">
574+
* {@code com.sun.tools.javac} API</a> instead.
551575
*
552576
* @since 3.0
553577
*/

src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@
5454
import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
5555

5656
/**
57-
* Compiles application sources
57+
* Compiles application sources.
58+
* By default uses the <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html">javac</a> compiler
59+
* of the JDK used to execute Maven. This can be overwritten through <a href="https://maven.apache.org/guides/mini/guide-using-toolchains.html">Toolchains</a>
60+
* or parameter {@link AbstractCompilerMojo#compilerId}.
5861
*
5962
* @author <a href="mailto:[email protected]">Jason van Zyl </a>
6063
* @since 2.0
64+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html">javac Command</a>
6165
*/
6266
@Mojo(
6367
name = "compile",
@@ -118,17 +122,15 @@ public class CompilerMojo extends AbstractCompilerMojo {
118122
private Set<String> incrementalExcludes = new HashSet<>();
119123

120124
/**
121-
* <p>
122125
* Specify where to place generated source files created by annotation processing. Only applies to JDK 1.6+
123-
* </p>
124126
*
125127
* @since 2.2
126128
*/
127129
@Parameter(defaultValue = "${project.build.directory}/generated-sources/annotations")
128130
private File generatedSourcesDirectory;
129131

130132
/**
131-
* Set this to 'true' to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on
133+
* Set this to {@code true} to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on
132134
* occasion.
133135
*/
134136
@Parameter(property = "maven.main.skip")
@@ -153,7 +155,8 @@ public class CompilerMojo extends AbstractCompilerMojo {
153155
private boolean multiReleaseOutput;
154156

155157
/**
156-
* when forking and debug activated the commandline used will be dumped in this file
158+
* When both {@link AbstractCompilerMojo#fork} and {@link AbstractCompilerMojo#debug} are enabled the commandline arguments used
159+
* will be dumped to this file.
157160
* @since 3.10.0
158161
*/
159162
@Parameter(defaultValue = "javac")

src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java

+4
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@
5050

5151
/**
5252
* Compiles application test sources.
53+
* By default uses the <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html">javac</a> compiler
54+
* of the JDK used to execute Maven. This can be overwritten through <a href="https://maven.apache.org/guides/mini/guide-using-toolchains.html">Toolchains</a>
55+
* or parameter {@link AbstractCompilerMojo#compilerId}.
5356
*
5457
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
5558
* @since 2.0
59+
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html">javac Command</a>
5660
*/
5761
@Mojo(
5862
name = "testCompile",

0 commit comments

Comments
 (0)