Lewis John McGibbney created NUTCH-3212:
-------------------------------------------

             Summary: Use javac --release 17 when building on JDK 21
                 Key: NUTCH-3212
                 URL: https://issues.apache.org/jira/browse/NUTCH-3212
             Project: Nutch
          Issue Type: Improvement
          Components: build
    Affects Versions: 1.23
            Reporter: Lewis John McGibbney
             Fix For: 1.24


Building Nutch on JDK 21 with {{javac.version=17}} ({{{}-source 17 -target 
17{}}}) produces a warning on every {{<javac>}} invocation, including one-file 
plugin test compiles:

{{warning: [options] system modules path not set in conjunction with -source 
17}}
JDK 21 is compiling for language 17 without {{{}--release{}}}, so it uses the 
JDK 21 bootstrap classes. That is also why JDK 21 CI reports {{java.net.URL}} 
constructor deprecations that do not appear on JDK 17.

A related {{Note}} appears when a processor is found on the classpath:

{{Note: Annotation processing is enabled because one or more processors were 
found on the class path.}}
Nutch does not run annotation processors at compile time.

Steps to reproduce
 # Use JDK 21.
 # {{ant clean compile}} (or CI {{{}tests (jdk 21, …){}}}).
 # Inspect javac output for plugin test compiles (e.g. 
{{{}protocol-selenium{}}}).

Expected

Quiet compile of Java 17 bytecode (major 61) on both JDK 17 and JDK 21.

Proposed change

In {{build.xml}} and {{{}src/plugin/build-plugin.xml{}}}, replace 
{{{}source{}}}/{{{}target="${javac.version}"{}}} with Ant 
{{release="${javac.version}"}} ({{{}--release 17{}}}). Optionally add 
{{{}-proc:none{}}}. Do not only add {{{}-Xlint:-options{}}}; that hides the 
warning and still compiles against JDK 21 APIs.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to