I have wondered that for a long time. In fact, if you run “mvn compile” followed by “mvn test” you will see
[INFO] Changes detected - recompiling the module! So obviously something is there that tries to detect changes. It just doesn’t seem to work. Ralph > On Jun 26, 2019, at 9:32 AM, Gary Gregory <[email protected]> wrote: > > On Wed, Jun 26, 2019 at 12:24 PM Ralph Goers <[email protected]> > wrote: > >> Those are mine as well. >> >> Unfortunately, if you use the toolchains plugin to specify the compiler >> version then all the tests are also going to run with that Java version. >> Since there is no getting around having sun.reflect.Reflection be used >> prior to Java 9 there is no way to use Java 11 to compile and test Log4j >> API. That only leaves you with the option of creating a phony jar. But >> that will have problems too as it will probably be used by the unit tests. >> >> The only other option is to create a separate module for the unit tests. >> > > But why does Maven recompile when nothing has changed? That's the real > problem, I ran a first build on Java 8, then all I want to do is run the > tests on Java 11. > > Gary > >> >> Ralph >> >>> On Jun 26, 2019, at 9:00 AM, Gary Gregory <[email protected]> >> wrote: >>> >>> On Wed, Jun 26, 2019 at 11:02 AM Ralph Goers <[email protected] >>> >>> wrote: >>> >>>> I don’t run the build with Java 11, although I do have projects that use >>>> it that are on Java 11. It seems that log4j-api is failing when >> compiling >>>> with Java 11 because sun.reflect.Reflection was removed in Java 9. I >> guess >>>> we need to modify the toolchains configuration to tell the main modules >> to >>>> use only Java 8 to compile. The only other option would be to create a >> jar >>>> that has that class in it and specify it as a provided dependency. >>>> >>> >>> My goal is to be able to answer the question: "Do all the tests pass on >>> Java 11?" >>> >>> I am OK for this release with not being able to _build_ on Java 11 but I >>> certainly should be able to run all tests with a plain old 'mvn test'. >>> >>> FWIW, at work, our platform requirements are Java 8 and 11. >>> >>> Gary >> >>
