Also, make sure you are building the release-2.x branch. The master branch will 
build with Maven and targets Java 11 but it u
ses some strange mechanics to get around the quirks of JPMS and this will make 
it a mess in your IDE.  Once things get back 
to normal I plan to fix up the master branch using suggestions we got from the 
Maven team.

Ralph

> On Dec 19, 2021, at 11:15 PM, Ralph Goers <[email protected]> wrote:
> 
> You must run the build with Java 8 as the default JDK. You need a toolchain 
> for Java 9 or greater. I’d recommend Java 11.
> 
> Ralph
> 
>> On Dec 19, 2021, at 10:53 PM, Dan Kegel <[email protected]> wrote:
>> 
>> 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
>> 
> 
> 

Reply via email to