Hi all! I'm trying to write an ide-free shell script to reproducibly build log4j from git on a fresh mac, following https://logging.apache.org/log4j/2.x/build.html and filling in the blanks. My current draft, http://kegel.com/install-log4j2-mac.sh.txt installs https://download.oracle.com/java/17/latest/jdk-17_macos-x64_bin.dmg and creates a toolchains.xml file: sed 's/java[789]/jdk-17.0.1.jdk/' < toolchains-sample-mac.xml > ~/.m2/toolchains.xml
Not too surprisingly, that fails with [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project log4j-api: Compilation failure [ERROR] /Users/dank/logdemo/logging-log4j2/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18] error: cannot find symbol [ERROR] symbol: class Reflection [ERROR] location: package sun.reflect I dimly recall sun.reflect going away ( https://stackoverflow.com/questions/23808803/sun-reflect-reflection-getcallerclass-alternative says it was removed from jdk8), so perhaps the way my script sets up ~/.m2/toolchain.xml isn't sufficient. Is one supposed to add something to toolchain.xml to tell javac to target a different version of the jdk in each of the jdk7/8/9 sections? Or do I actually have to go dig up an ancient JDK 1.7 to make maven and log4j happy? https://blog.hcf.dev/article/2019-09-15-maven-toolchains-xml-script suggests the latter, ugh... Thanks, Dan Kegel
