boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 180 forks source link

"illegal reflective access" warning under Java 9 #662

Closed cloojure closed 6 years ago

cloojure commented 6 years ago

Boot Bug Report

Platform details

Platform (macOS, Linux, Windows): Platform version: Ubuntu 16.04 JRE/JDK version (java -version): 1.9.0

Boot details

> boot --version
#http://boot-clj.com
#Sat Nov 18 14:17:41 PST 2017
BOOT_VERSION=2.7.2
BOOT_CLOJURE_VERSION=1.8.0
BOOT_CLOJURE_NAME=org.clojure/clojure

> java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

build.boot present? (yes/no): No ~/.boot/profile present? (yes/no): No Task name? (if applicable): boot repl

build.boot content (if applicable)

N/A

~/.boot/profile content (if applicable)

;; ~/.boot/profile content here

Description

Boot generates "illegal reflective access" warning under Java 9

~/work/pedestal/hello-world > boot repl
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by dynapath.defaults$fn__1516$fn__1517 (file:/home/alan/.m2/repository/boot/pod/2.7.2/pod-2.7.2.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of dynapath.defaults$fn__1516$fn__1517
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
nREPL server started on port 40601 on host 127.0.0.1 - nrepl://127.0.0.1:40601
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 9.0.1+11
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> 

Steps to reproduce

ykomatsu commented 6 years ago

This issue will be fixed with: tobias/dynapath@94ee4b9ec84764707b6df0751226086faedfa8af

martinklepsch commented 6 years ago

This is fixed in 2.8.0-SNAPSHOT due for proper release soon.

delitescere commented 6 years ago

While we wait for 2.8, a temporary workaround is to set use the --add-opens JVM command line option.

tl;dr Add the following POSIX shell commands to your ~/.profile file:

# Temporary workaround for boot-clj 2.7 on Java 9
if [ -r ~/.boot/boot.properties ] && which java >/dev/null; then
  (
  JAVA_MAJOR_VERSION=$(java -version 2>&1 | head -1 | cut -d '"' -f 2 | cut -c1)
  [ $JAVA_MAJOR_VERSION -ne 9 ] && exit 1
  . ~/.boot/boot.properties
  [ ${BOOT_VERSION:0:1} -eq 2 ] && [ ${BOOT_VERSION:2:1} -lt 8 ]
  ) && export BOOT_JVM_OPTIONS=--add-opens=java.base/java.net=ALL-UNNAMED
fi

To not use an exported variable (e.g. on a CI server):

$ boot help
ARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by dynapath.defaults$fn__1212$fn__1213 (file:~/.m2/repository/boot/pod/2.7.1/pod-2.7.1.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of dynapath.defaults$fn__1212$fn__1213
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Usage:   boot OPTS <task> TASK_OPTS <task> TASK_OPTS ...

Temporarily setting BOOT_JVM_OPTIONS to send command line options to the java command:

$ BOOT_JVM_OPTIONS=--add-opens=java.base/java.net=ALL-UNNAMED boot help

Usage:   boot OPTS <task> TASK_OPTS <task> TASK_OPTS ...
gunar commented 6 years ago

Whoah, thanks